Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Published © GPL3+

LED Blink Pattern

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

BeginnerFull instructions provided36,294
LED Blink Pattern

Things used in this project

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