Use the relay to light up 2 LEDs in a simple sequence
Equipment:
•1 x Arduino Uno
•1 x Breadboard
•14 x Wire
•1 x 1N4001
•1 x Transistor
•1 x Relay DPDT
•1 x 560 Ohm Resistor
•1 x 2.2k Ohm Resistor
•2 x LED
Reference:
http://www.oomlout.com/a/products/ardx/circ-11
Program Details:
There's no new content in the code compared to the other labs
Time to Complete:
15 minutes
Results:
The relay used was different than the one on the breadboard sheet, a few wires had to be moved to get one of the LEDs into the circuit. After moving the wires, the relay would perform a constant clicking sound and light up the LEDs one at a time.
Photos of Project:
Tips:
Check to see if the relay is the same as the one in the breadboard sheet.
Further Work:
Instead of LEDs, we can use motors.
Program Modifications:
The program is exactly the one from http://www.oomlout.com/a/products/ardx/circ-11
int ledPin = 2; // pin that the LED is connected to
void setup()
{
pinMode(ledPin, OUTPUT); //initializes pin 2 as an output
}
pinMode(ledPin, OUTPUT); //initializes pin 2 as an output
}
void loop() //Continuously runs
{
digitalWrite(ledPin, HIGH); // set the state of ledPin to high(on)
delay(1000); // delay for 1000ms
digitalWrite(ledPin, LOW); // set the state of ledPin to low(off)
delay(1000); // delay for 1000ms
}
{
digitalWrite(ledPin, HIGH); // set the state of ledPin to high(on)
delay(1000); // delay for 1000ms
digitalWrite(ledPin, LOW); // set the state of ledPin to low(off)
delay(1000); // delay for 1000ms
}