Pages: [1]   Go Down
Author Topic: can i flash different LED program on the arduino uno at the same time  (Read 306 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I just need some help. I have a two LED on a bread board one LED is connected to pin 7 and the other to pin 4. I need pin 7 to run a delay 4000 and pin 4 to run a delay of 1000. can i program the arduino to do this or is it just one at a time.

thanks.
Logged

BHZ, MG, Brazil
Offline Offline
Sr. Member
****
Karma: 10
Posts: 346
Android developer; Arduino enthusiast
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, easily. You just won't use the delay() function for that. Instead you'll use the millis() function.

Take a look at this tutorial: http://arduino.cc/en/Tutorial/BlinkWithoutDelay

You'll adapt it to control 2 LEDs, however, and have 2 time control variables.

In fact, Nick Gammon has done a sketch that does just that:

http://www.gammon.com.au/forum/?id=11411
Logged

Learn to live: Live to learn.
Showing off my work: http://arduino.cc/forum/index.php/topic,126197.0.html

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks thats the one smiley
Logged

Pages: [1]   Go Up
Jump to: