LED Light Effect on Arduino Uno

Hey guys! Today I will be sharing my first (worthy of a blog post) Arduino project with you.

If you don’t know what Arduino is, Arduino is an open-source microcontroller board for building and prototyping electronics project.

The circuit is below.

a8l7b

Sorry for the shaky camera.

 

So I have four wires going from pins 2-6 to the breadboard. Then I have resistors connected to the led’s negative (long) leg. Then from each of the LED’s positive (short) legs, I have wires going to a single ground wire on the Arduino.

 

Here is the code:

int timer = 90;
void setup() {
  for(int thisPin = 2; thisPin < 8; thisPin++) {
    pinMode(thisPin,OUTPUT);
  }
}
void loop() {
  for(int thisPin = 2; thisPin < 8; thisPin++) {
    digitalWrite(thisPin,HIGH);
    delay(timer);
    digitalWrite(thisPin,LOW);
    delay(timer);
  }
  for(int thisPin = 7; thisPin >= 2; thisPin--) {
    digitalWrite(thisPin,HIGH);
    delay(timer);
    digitalWrite(thisPin,LOW);
    delay(timer);
  }
}

Enjoy!

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