Step 1: Parts Required
You will require the following parts :—
1) Arduino Uno ( You can use any version of Arduino )
2) 2 Led’s
3)Breadboard
4) Breadboard Wires
5) Wire Stripper
Step 2: About Fixing Led’s
The Led operate at 3V DC. The led’s can be easily drawn by Arduino board. It has to be remembered that the shorter leg of an led is – negative & longer led is + positive.
Fix the Led as shown in image.
Step 3: Connecting Led to BreadBoard
1) Connect the ground of Led’s to GND Pin of Arduino.
2) Connect +ve of one Led to 12th Pin of Arduino.
3) Connect -ve of second Led to 11th Pin of Arduino
4) Connect the USB Cable from computer to Arduino
Step 4: Disco Light Program
Below is the code for running disco lights using Two Led’s. Upload the code to Arduino :—
/*
Disco Lights Turns on 1st LED on for one second, then 2nd Led for one second, repeatedly.
*/
void setup() {
// initialize the digital pin as an output.
// Pin 12 & 11 have LED’s+ connected.
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
}
void loop() {
digitalWrite(12, HIGH); // set the LED on 12th Pin on
digitalWrite(11, LOW); // set the LED on 11th Pin off
delay(1000); // wait for a second
digitalWrite(12, LOW ); // set the LED on 12th Pin off
digitalWrite(11, HIGH); // set the LED on 11th Pin on
delay(1000); // wait for a second
}
Leave a Reply
You must be logged in to post a comment.