arduino mega anaolog pins as outputs

Hi there,

I'm using an arduino mega to turn 12v RGB leds on and off via an LM298 module. Easy enough and the standard digital IO pins up to 53 work as expected .

However when I assign the analog outputs (pins 54 - 69) as outputs they don't function as expected. Strangely the LEDs turn on but not off. . . but sometimes if i toggle another random output they do switch off. .

Is there something else I need to consider when using analog in pins as outputs? Do I need pull up/down resistors or something etc?

many thanks

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

We need to see your code, please.

Thanks.. Tom... :slight_smile:

thanks for your reply. I'm using firmata to control the board via the program 'pure data'. I believe that might be the problem, after further tests it seems the firmata doesn't work properly with a mega which is a shame. Thanks for your reply

I have never used Firmata but I know that the analog pins on an Uno or Mega can be used as normal digital I/O pins

...R

Hi,
Have you written a simple bit of code to prove your theory?
That is code that just concerns those two outputs?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Have you written a simple bit of code to prove your theory?

I assume your "you" refers to the OP rather than to my Reply #3.

If I am wrong please let me know.

...R

Hi,
@bananaplug
Have you written a simple bit of code to prove your theory?
That is code that just concerns those two outputs?

Thanks.. Tom.. :)

bananaplug:
...to turn 12v RGB leds on and off via an LM298 module...

Did you compensate for the fact that an LM298 (L298) 'looses' several volts.
You might need a 15volt supply for your 12volt LEDs.
Or dump that L298, and use a logic level mosfet (as everybode else does).
Leo..

Hi,
How do you define the analog pins as output.

pinMode(54,OUTPUT);

or

pinMode(A0,OUTPUT);

Tom... :slight_smile:

ARDUINO ANALOG PINS ARE USED AS DIGITAL PINS ALSO.....

I WORKED THIS TYPE OF CIRCUITS IN MY REAL-TIME EXAMPLES....