Go Down

Topic: Usinga A0-A5 pins for analog output fade (Read 254 times) previous topic - next topic

The_Encoder

Hello! I'm using an Arduino Uno and all the digital PWM ports (3, 5, 6, 9, 10, 11) are used already. I was wondering how can I use A0 to A5 for a fade on leds because I tried and the led starts getting brighter only when analogWrite value is >= 130. Can you please help me as it is kind of urgent.

Paul__B

That would be because these pins are analog inputs, not PWM.

You need a PWM driver IC.  Like this:


It uses A4 and A5.

The_Encoder


pert

As an alternative to the solution of adding more PWM pins via external hardware as recommended by Paul__B, you also have the option of using software PWM to generate a PWM output on any Arduino pin. This is far inferior to hardware PWM but it might be appropriate for some applications. I have found this soft PWM library to be very good:
https://github.com/per1234/PalatisSoftPWM

Go Up