Introduction: 6 LED Pendulum With Arduino

Picture of 6 LED Pendulum With Arduino

This is what you need to make a 6 LED Pendulum with Arduino:

6x     LEDS
6x     330 Ohm Resistors
7x     Jumper Wires
1x     Breadboard or Perfboard
1x     Arduino Uno or Arduino Mega 2560

This project does not take long to do at all.

This is the code that I used:

int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int led6 = 8;


// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pins as outputs.
pinMode(led1, OUTPUT);   
pinMode(led2, OUTPUT);   
pinMode(led3, OUTPUT);   
pinMode(led4, OUTPUT);   
pinMode(led5, OUTPUT);   
pinMode(led6, OUTPUT);   

}

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

  digitalWrite(led5, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100); 
  digitalWrite(led6, LOW);    // turn the LED off by making the voltage LOW
  delay(100);
  digitalWrite(led4, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100); 
  digitalWrite(led5, LOW);    // turn the LED off by making the voltage LOW
  delay(100);
  digitalWrite(led3, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100); 
  digitalWrite(led4, LOW);    // turn the LED off by making the voltage LOW
  delay(100);
  digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100); 
  digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
  delay(100);
digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
  delay(100);



}

Comments

orirum (author)2016-02-21

i am confused...how do i apply it or maybe you have an example of the outcome.

orirum (author)2016-02-21

i am confused...how do i apply it or maybe you have an example of the outcome.

About This Instructable

2,095views

12favorites

License:

More by JSTArollin:T-Shirt Wall ArtSteal the Bacon Game with Arduino6 LED Pendulum with Arduino
Add instructable to: