loading

In this tutorial, you will learn how to set up an Arduino Board with three LED lights and code them to go on and off to the beat of the song Funkytown.

**This tutorial was written by three of my students in my Fundamentals of Design Class. They are tenth graders who learned Arduino for the first time. Part of their assignment was to try and write a tutorial for a project they worked on to help solidify their knowledge of Arduino. Please feel free to comment on the ease of following the tutorial and any feedback you would give them about future tutorials. Thanks! **

Step 1: Materials Needed

Arduino board and breadboard

7 wires (three can be of the same color but the rest should be multiple colors) (Example-3 orange wires, 1 white wire, 1 black wire, 1 green wire, and 1 red wire)

1 button

3 LEDs (preferably different colors) (Example- 1 blue LED, 1 red LED, and 1 green LED)

3 200 Ohm resistors (for the LEDs)

1 10K Ohm resistor (for the button)

Cable to connect to the computer

Computer

1.4) Important Information and Tips: On the breadboard the red line on either side represents a positive charge, the black or blue lines represent a negative charge. On an LED the long leg represents positive whereas the short leg represents negative When bending a resistor to fit into a hole, use your fingernail to bend the wires right next to the ceramic piece. Do this on both sides of the ceramic. This will make it much easier to fit the resistor into the hole without having to bend the resistor’s legs in funky ways Make sure the button is firmly in the breadboard

1.8) Brackets: When reading the code the brackets mark the beginning and end of a set of code so, if there is an open or closed bracket after a code it is not to be confused with an open or closed parenthesis.

Step 2:

Setting Up the Circuit:

Step 1: Take the USB cord and plug it into your computer and the arduino board.

Second Step: Plug a wire into the 5v slot on the Arduino board into the positive red column on the breadboard.

Third Step: Take another wire and plug it into the GND spot below the 5v slot and connect the wire to the black negative column next to the previous wire.

Fourth step: Take three new wires and plug them into in three different pins on the Arduino board and plug the other ends into three different rows on the breadboard on the side closest to where you plugged in the previous two wires.

Fifth step: take three ohm resistors and plug each one into the row below the three previous wires. One end of the resistor goes in the row below the wire, and the other end connects to the negative black column that also contains the GND wire as previously mentioned.

Sixth Step: For the LEDs, take note of the short(negative) and long(positive) ends. The long end needs to be plugged into the same row as one of the pincode wires and the shorter end needs to be plugged into the row directly below it, in line with the ohm resistor. Repeat this process for the next two LEDs and the remaining two pincode wires and their individual resistors.

Seventh Step: Take a new wire and plug one end into the red, positive column and the other into a row on the breadboard.

Eighth Step: Take the 10k resistor and plug 1 end into the negative black column and the other end two rows below the previous wire. For example, if the previous wire was plugged into row 23, the resistor should be plugged into row 25.

Ninth Step: Now take one more wire and plug one end into a pin slot on the Arduino board and the other into the same row as the 10k resistor. Tenth Step: Lastly, take the button and plug it into same row as the 10k resistor and the wire that is only connected to the breadboard.

Step 3: Code

This is the code to make your Arduino blink to the beat of funkytown. so once you have grabbed the right

* materials and plugged into your arduino in the right places, this will be the code you will be using * to make your LEDS beat to Funkytown */

int switchState = 0;

int t = 170 ; // the delay you've set

int b = 150; // so whatever delay you put the letter next to will have that time

int s = 75; // The reason there are multiple beats is so it will fit with the beat of the music

const int blue = 3; // instead of digital pin 3 you can set it to the color or whatever name you want.

const int red = 4 ;

const int green = 5 ;

void setup() { // put your setup code here, to run once:

pinMode(blue,OUTPUT); // the pin you’ve used

pinMode(red ,OUTPUT);

pinMode(green ,OUTPUT);

pinMode(6,INPUT);

}

void loop() { // put your main code here, to run repeatedly:

switchState = digitalRead(2);

if (switchState == LOW) { // the button is not pressed

digitalWrite(blue, LOW); //blue

digitalWrite(red , LOW); //red

digitalWrite(green , LOW); //green

}

else { // the button is pressed

digitalWrite(red , HIGH);

delay(t); // the time you've set to wait

digitalWrite(red , LOW);

delay(t);

digitalWrite(red , HIGH); // HIGH = on

delay(t);

digitalWrite(red , LOW); // LOW = off

delay(t);

digitalWrite(blue, HIGH); // HIGH, LOW, HIGH, LOW = one blink

delay(t);

digitalWrite(blue, LOW);

delay(t);

digitalWrite(red , HIGH);

delay(t);

digitalWrite(red , LOW);

delay(t); // your delay is 170

digitalWrite(blue, HIGH);

delay(b); // your delay is 150

digitalWrite(blue, LOW); // the reason there is not a delay is to make it fit with the beat a delay would have slowed it down too much

digitalWrite(blue, HIGH);

delay(b);

digitalWrite(blue, LOW);

digitalWrite(blue, HIGH);

delay(b);

digitalWrite(blue, LOW);

delay(b);

digitalWrite(blue, HIGH);

delay(b);

digitalWrite(blue, LOW);

digitalWrite(red , HIGH);

delay(t);

digitalWrite(red , LOW);

delay(t);

digitalWrite(green , HIGH);

delay(t);

digitalWrite(green , LOW);

delay(t);

digitalWrite(red , HIGH);

delay(t);

digitalWrite(red , LOW);

delay(t);

digitalWrite(blue, HIGH);

delay(s); // your delay is 75

digitalWrite(blue, LOW);

delay(t);

}

}

not bad, I could quite easily assemble that, I would only make one point ( being a tenth grader wrote it) that power, that is being supplied to arduino via the usb cable, should only be applied after the circuitry has been assembled. not a biggy for this simple circuit but good practice for more complex circuits that may damage the arduino or components if power is present during assembly... and heaven forbid electrocution. <br><br>otherwise excellent work :-D
<p>Thanks for sharing :)</p>

About This Instructable

1,711views

24favorites

License:

More by DillerS:The Arduino of Funk - a Student Project 
Add instructable to: