Go Down

Topic: What's the best way drive multiple LEDs simultaneously? (Read 1 time) previous topic - next topic


Hi, I'm new to arduino. I currently have a mega 2560 and about 40 LEDs. I want to drive them one by one and also some (or all) selected LEDs at the same time. From the reference, it seems that I can use port manipulation (DDRX, PORTX). However since all the pins are spread out to multiple ports, will there be a lot delay between pins located in different ports?


Feb 07, 2012, 07:02 am Last Edit: Feb 07, 2012, 07:04 am by CrossRoads Reason: 1
Not so that you would notice.  16 MHz is pretty darn fast!
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


You can use the normal digitalWrite on all the pins and you will still not see any delay.


Just beware of the total current limit of the mega. I believe it's 200ma, which would be 5ma per LED to prevent damage.


I believe it's 200ma,

Bit of a grey area this. The data sheet says power & ground is limited to 200mA per pin. But the Mega chip has 4 pins so that might make it 800mA. But others disagree.

Go Up