LED PENDULUM

This project is a follow up to my last project named “knight rider”.

Here with a little change in the knight riders code we have assembled a circuit that demonstrates a physical pendulum.

HARDWARE REQUIRED :-

  1. Arduino uno
  2. breadboard
  3. jumper wires
  4. 5 x 330 ohm resistors
  5. 5 LED’s

The circuit design remains same as in knight rider.

I’ll strongly recommend you to try knight rider first before trying on this one.

CODE

//creating the variable and assigning them pin numbers
int led2 = 6;
int led3 = 5;
int led4 = 4;
int led5 = 3;
int led6 = 2;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pins as outputs.

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(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);

}

This gives us a electronic pendulum who’s delay time can be controlled as according to our wish.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s