loading
In this tutorial I will show you how to make multiple LEDs blink with Arduino.  You will need three LEDs, jumper wires, breadboard, and Arduino.

Step 1: Program The Arduino

Now you will need to paste the following code into the Arduino software and upload it to the Arduino.

int led = 13;
int led2 = 12;
int led3 = 11;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT); 
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(100); 
  {digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led2, LOW);
delay(100);}
{digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led3, LOW);
delay(100);}// wait for a second
}

<p>This is my first project ever with Arduino or anything hardware related. Thanks so much! Super pumped to level up. </p>
<p>Hey,</p><p>I am using Arduino with RTC to operate the lights of my home.</p><p>I want at 10 PM all my lights should OFF and at 6 AM same should be ON.</p><p>I have completed everything but only unable to tell Arduino to read time from RTC to operate lights.</p><p>Can it be done by reading Arduino Serial Monitor? If yes, then HOW.</p><p>Also the other possible method to do same through Arduino.</p><p>Thanks.</p>
<p> Thanks for sharing! This is one of my first projects with my Arduino and it went really well.</p>
<p>Develop a reaction game for two players. The game starts with<br>both LEDs on. After a random time (between 1 and 10 seconds) both LEDs go off<br>and the board waits for one of the buttons to be clicked. The goal of both<br>players is to press their button as fast as possible after they see the LEDs<br>turned off. The faster player wins and the appropriate LED is turned on (for 5<br>seconds) to show the winner. Then both LEDs are turned on and the game repeats.</p><p>there is any body now how can do it</p>
<p>Perhaps you can help me</p><p>Im looking for code that will switch an LED on then off withing a single loop</p><p>without using the delay() function. Everywhere I look there are modified versions of the 'blink without delay' however they all have the same issue</p><p>loop starts the use millis() and a few variable to check the state if its high or low then swop the state over but only swops it once so the loop runs it switches on then the loop has to run a second time before it switches off. Any ideas?</p>
<p>This example will blink multiple LEDs all at different rates. </p><p><a href="http://oosmos.com/examples/blink" rel="nofollow">http://oosmos.com/examples/blink </a> </p>
<p><a href="http://arduino.cc/en/Reference/analogWrite" rel="nofollow">http://arduino.cc/en/Reference/analogWrite</a></p><p>using the analog pins should help with your problem.</p>
thanks for sharing the code. I'm new to arduino programing. I'm able to run this program successfully.
<p>Thanks for the interesting photo. Could you tell us what programming board is that?</p><p>Can you share the wirings too?</p>
<p>Do you know how to do it in a forLoop? If so can post the code</p>
<p>are you not using resistors on your leds</p>
<p>Thanks man! I add 3 more LEDs and it works great!!</p>
great to see my first arduino project being supported by instructables
<p>if the video is private why are you posting the youtube link here ? is it to show us the black screen ? thanks for sharing</p>
Oops sorry about that. I fixed it.
<p>Help</p>
<p>Help</p>
<p>It dos not work. why?</p>
<p>thanks for your help!!</p>
<p>i've modified your code, just a little bit here is:</p><p>int led = 13;<br>int led2 = 12;<br>int led3 = 11;<br><br>// the setup routine runs once when you press reset:<br>void setup() { <br> // initialize the digital pin as an output.<br> pinMode(led, OUTPUT);<br> pinMode(led2, OUTPUT);<br>pinMode(led3, OUTPUT); <br>}<br><br>// the loop routine runs over and over again forever:<br>void loop() {<br>digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)<br>delay(100); // wait for a second<br>digitalWrite(led, LOW); // turn the LED off by making the voltage LOW<br>delay(1000); <br>digitalWrite(led, HIGH);<br>delay(100); <br>digitalWrite(led, LOW);<br>delay (1000);<br>{digitalWrite(led2, HIGH);<br>delay(100);<br>digitalWrite(led2, LOW);<br>delay(1000);<br>digitalWrite(led2, HIGH);<br>delay(100);<br>digitalWrite(led2, LOW);<br>delay(1000);}<br>{digitalWrite(led3, HIGH);<br>delay(100);<br>digitalWrite(led3, LOW);<br>delay (1000);<br>digitalWrite(led3, HIGH);<br>delay(100);<br>digitalWrite(led3, LOW);<br>delay(1000);}// wait for a second<br>digitalWrite(led2, HIGH);<br>delay(100); <br>digitalWrite(led2, LOW);<br>delay (100);<br>digitalWrite(led2, HIGH);<br>delay(100); <br>digitalWrite(led2, LOW);<br>delay (100);<br>{digitalWrite(led, HIGH);<br>delay(100);<br>digitalWrite(led, LOW);<br>delay(100);<br>digitalWrite(led, HIGH);<br>delay(100);<br>digitalWrite(led, LOW);<br>delay(100);}<br>{digitalWrite(led3, HIGH);<br>delay(100);<br>digitalWrite(led3, LOW);<br>delay (100);<br>digitalWrite(led3, HIGH);<br>delay(100);<br>digitalWrite(led3, LOW);<br>delay(100);}<br>}</p>
<p>its really works!! thanks, but i think you should add the resistors to the led. i using 220k resistor and 3 different leds,</p>
<p>Hi, could you explain why we would list int led = 13; and not int led 1 = 13<br>I know default 13 is a blink led , is that why ?<br>Can we use 13 for other things , what do we have to do different while addressing pin 13?<br>Thanks.</p><p>int led = 13;<br> int led2 = 12;<br> int led3 = 11;</p>
<p>worked! thanks</p>
I would just like to say I hope you know the comments are incorrect about the length of time the delays are. <br> <br>The delay you have it set to is to delay for 1/10 of a second
Thanks! Glad it worked.
Thanks! This is explained perfectly, this is my first aduino project ever and it turned out beautifully!

About This Instructable

124,251views

37favorites

License:

More by The Electrodog Show:Checking Battery Status on Mediatek LinkIt One Checking Your Current Location With MediaTek LinkIT One Controling Low Voltage Devices with MediaTek LinkIt One 
Add instructable to: