softPWM library

Hi all. I'm just trying to find out if the softPWM library allows you to use any digital / analog pins, instead of only the few PWM pins on the uno?

It does but it does that in software needing a lot of your CPU. The PWM pins do the same with a lot of support from the hardware. Doing it in software is much slower and is only acceptable if you don't need your CPU for many other tasks.

Thanks, that's really good to know.

I'm looking at putting some LED's up my stairs and thinking about using a ATmega328p IC to run the 14 channels I need. I will also need a couple of digital inputs for sensors so I might set up the analog inputs as digital. This should keep the project really cheap and be quite simple for me to get going :slight_smile:

Can you see any issues with this set up? I don't need the cpu for anything else.

I've never done such a thing (PWM on 14 pins), but I would try to use that libary (it's probably the easiest and fastest way), if you fail because the CPU cannot fulfill your requirements, I would try to program this yourself. With a clever programming of timer 1 and a short ISR you might get good enough results for dimming 14 channels of LED.

Easier and not much more expensive is to use chips as the WS2801 or probably better a chip with more channels such as the TCL5940 (Arduino Playground - TLC5940).