Published © GPL3+

LED Blink Pattern

A simple, basic LED project to get someone new to Arduino started

EasyFull instructions provided35,263
LED Blink Pattern

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×10
LED (generic)
LED (generic)
×3
Resistor 221 ohm
Resistor 221 ohm
×3

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

LED Blinking Patterns Circuit Diagram

Code

LED Blinking Patterns Sketch

C/C++
INO sketch for Arduino IDE that runs the displayed program for this project
/*
  Blinking LEDs - test program to run 3 LEDs in a pattern of blinks
*/

int yellowled = 12;
int greenled = 10;
int blueled = 7;

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

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(yellowled, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(yellowled, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(greenled, HIGH);    // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(greenled, LOW);     // turn the LED off by making the voltage LOW
  digitalWrite(blueled, HIGH);     // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(blueled, LOW);      // turn the LED off by making the voltage LOW
  delay(500);                     // wait for a second
}

Credits

Comments