analogWrite not working on OLIMEXINO-328

Started by vitaly, November 07, 2019, 09:54:16 AM

Previous topic - Next topic

vitaly

Hi,
I'm trying to run a glowing led code on the board using A0 pin as analog output but I'm getting just an on/off led behavior.
I've tried to search the manual regarding analog or pwm output but found no single word about it.
Can somebody clarify this?

Gerrit

You can't do that on A0

PWM output is possible on digital I/O pins 3, 5, 6, 9, 10 and 11


If you really need A0 you can bit bang-it.

https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM

vitaly

Thank you for help, Gerrit!
The only place to find this info is datasheet of the MCU I guess? Or I missed something in the Olimexino manual? All what it says that A0-A5 is analog pins, that it. So I thought it's analog input/output but appears it's input only. Seems the manual needs some improvements.
Anyways, thank you again!

JohnS

Regardless, you're not using it as analog.  You're using it as digital with an on-off repetition fast enough to fool the eye.

It would actually make little sense to use analog with a diode (LED)...

John