The Arduino = Arduino UNO purchased at Radio Shack
The Breadboard= Radio Shack (not necessary, but I already made the prototyping stand. http://www.instructables.com/id/Acrylic-Arduino-Prototyping-Stand/)
LEDs and jumper wires = you guessed it... Radio Shack
The power source is Altoids charger that supply's 5v to the Arduino board ( http://www.instructables.com/id/Another-Altoids-Ipod-Charger/)
You can also use a 9v battery with resistors that are appropriate or use usb from laptop or desk top computer.
The software I used I downloaded from http://arduino.cc/en/Main/Software
I understand there are many ways one can do this. I chose to build it this way because this is what I had.
I connected the jumper wires to the #2,4,6,8,10 pins found on the Arduino board and the long leg of the Led are placed in line with the end of the red jumper wires on the breadboard.
.
The ground pin is located above the #13 pin (GND) on the Arduino board.
The Code I wrote is a modified version of the blink example:
/*
Blink
Turns on an LED on for 1 second, then off for 1 second.
This example code is in the public domain.
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(6, OUTPUT);
pinMode(8, OUTPUT);
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH); // White Led on for 1 second
delay(1000);
digitalWrite(2, LOW); // LED turns off for 1/2 second
delay(500);
digitalWrite(4, HIGH); // Yellow led on 1/2 second
delay(500);
digitalWrite(4, LOW); // LED turns off for 1/2 second
delay(500);
digitalWrite(6, HIGH); // Yellow Led on for 1/2 second
delay(500);
digitalWrite(6, LOW); // LED turns off for 1/2 second
delay(500);
digitalWrite(8, HIGH); // Yellow Led on for 1/2 sec
delay(500);
digitalWrite(8, LOW); // LED turns off for 1/2 second
delay(500);
digitalWrite(10, HIGH); // Green Led on for 2 seconds
delay(2000);
digitalWrite(10, LOW); // Green LED turns off for 3 seconds
delay(3000);
}


































Visit Our Store »
Go Pro Today »




I hope you do finish yours so I can learn from it.
First I add another white led. That one is Pre Stage (Pin 2) and the second one is for the Stage (Pin 3). Then I have change timing in between the leds so here is the code:
/*
Blink
Turns on an LED on for 1 second, then off for 1 second.
This example code is in the public domain.
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(6, OUTPUT);
pinMode(8, OUTPUT);
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH); // White Led on for 2 second Pre Stage
delay(2000);
digitalWrite(2, LOW); // LED turns off for 1/2 second
delay(5);
digitalWrite(3, HIGH); // White Led on for 1 second Stage
delay(1000);
digitalWrite(3, LOW); // LED turns off for 1/2 second
delay(5);
digitalWrite(4, HIGH); // Yellow led on 1/2 second
delay(500);
digitalWrite(4, LOW); // LED turns off for 1/2 second
delay(5);
digitalWrite(6, HIGH); // Yellow Led on for 1/2 second
delay(500);
digitalWrite(6, LOW); // LED turns off for 1/2 second
delay(5);
digitalWrite(8, HIGH); // Yellow Led on for 1/2 sec
delay(500);
digitalWrite(8, LOW); // LED turns off for 1/2 second
delay(5);
digitalWrite(10, HIGH); // Green Led on for 5 seconds
delay(5000);
digitalWrite(10, LOW); // Green LED turns off for 5 seconds
delay(5000);
}
ENJOY DRAG RACING
â¢220-Ohm resistor
â¢LED
â¢Photocell
â¢10k resistor
here is the Sketch:
int photocellPin = 0;// Photocell connected to analog pin 0
int photocellVal = 0; // define photocell variable
int ledPin = 9;// LED connected to digital pin 9
int ledState = 0;//state of the led
int fadeDown = 30;//delay per fade
int fadeUp = 20;//delay per fade
int minLight = 100;//min light threshold
int maxLight = 100;//max light threshold
void setup() {
//Serial.begin(9600);
pinMode(photocellPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
photocellVal = analogRead(photocellPin);
if (photocellVal < minLight and ledState == 0){
fadeLed(1);
//Serial.println("fade up");
}
else if (photocellVal > maxLight and ledState == 1){
fadeLed(0);
// Serial.println("fade down");
}
}
void fadeLed(int num){
if (num == 1){
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
analogWrite(ledPin, fadeValue);
delay(fadeUp);
}
ledState = 1;
}
else{
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
analogWrite(ledPin, fadeValue);
delay(fadeDown);
}
ledState = 0;
}
}
just a comment but it looks great your project