Hi,
I am trying to do a fade out (not fade in/fade ou, just fade out) on some LEDs connected to non-pwm pins of arduino, so basically cannot use analogWrite. Does anyone have any idea how i can do that, or fake pwm?
thanjks
ayah
Hi,
I am trying to do a fade out (not fade in/fade ou, just fade out) on some LEDs connected to non-pwm pins of arduino, so basically cannot use analogWrite. Does anyone have any idea how i can do that, or fake pwm?
thanjks
ayah
Software PWM using either a timer to determine when to pulse the pin or delays.
another way is to use chips that can generate PWM, or a digital variable resistor. I think there's something on variable resistor in the playground.
The other way is to connect the cathode to ground and the anode through one value of resistor to one digital output pin and the same anode to another resistor of twice the value to another digital output pin. Then you will have 4 levels of brightness available (one being off). In software make the pin an output and put it high, or make the pin an input to add or remove the current contribution from the resistor.
If you an another resistor and pin you have 8 levels and so on. Values to use would be 200 ohms, 400 ohms and 800 ohms, or as close as possible to those values it doesn't matter too much.