Blinky, is your first experiment in the world of Arduino. Let's blink! We will connect a LED to pin 13 of Arduino and turn it ON/OFF every second.


Sandeep (talk) 16:13, 4 March 2016 (IST)

Hook Up

Aurduino Blink a LED.JPG

Code

  1. /*
  2. Blink a LED
  3. Turns on an LED on for one second, then off for one second, repeatedly.
  4.  
  5. */
  6.  
  7. // Pin 13 has an LED connected on most Arduino boards.
  8. // give it a name:
  9. int led = 13;
  10. // the setup routine runs once when you press reset:
  11. void setup() {
  12. // initialize the digital pin as an output.
  13. pinMode(led, OUTPUT);
  14. }
  15. // the loop routine runs over and over again forever:
  16. void loop() {
  17. digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
  18. delay(1000); // wait for a second
  19. digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
  20. delay(1000); // wait for a second
  21. }