Arduino Cylon Eye
Hello! Today I'm going to show you how to make a Cylon Eye form Battlestar Galactica.
Parts
For this project, you will need:
- Arduino Uno/Genuino
- Red LED (7)
- 100 ohm (7)
- Jumpers (8)
- Breadboard
- USB B Cable
- Arduino IDE
Here's a video tutorial of this project, if you'd prefer that:
The Circuit
Here's ho sto assemble the circuit:
- Insert your LEDs in to your breadboard. Keep them close together to maintain the cylon effect. Have the anodes at the right and the cathodes to the left.
- Place a resistor at the cathodes of every LED.
- Place a jumper in digital pins 0-6. Place the other end of that jumper at the anodes of them LEDs.
- Place a jumper in the GND pin of the Arduino and connect it to the power bus of the breadboard. Make sure the ground wire is in the same row as the resistors.
That's it for the circuit. Now you need to upload the code and that's it. I hoped you enjoyed this project and, as always, Happy Making!
The Code
Before you upload the program, you should definitely read the code notes. This is a pretty basic program and these commands are very useful when writing code for Arduino.
//defines which pin each LED corresponds to
int led_1 = 0;
int led_2 = 1;
int led_3 = 2;
int led_4 = 3;
int led_5 = 4;
int led_6 = 5;
int led_7 = 6;
void setup() {
// set up all the LEDs as OUTPUT
pinMode(led_1, OUTPUT); p
inMode(led_2, OUTPUT);
pinMode(led_3, OUTPUT);
pinMode(led_4, OUTPUT);
pinMode(led_5, OUTPUT);
pinMode(led_6, OUTPUT);
pinMode(led_7, OUTPUT); }
void loop() {
//1 digitalWrite(led_1, HIGH); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//2 digitalWrite(led_1, LOW); digitalWrite(led_2, HIGH); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//3 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, HIGH); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//4 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, HIGH); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//5 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, HIGH); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//6 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, HIGH); digitalWrite(led_7, LOW); delay(100);
//7 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, HIGH); delay(100);
//6 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, HIGH); digitalWrite(led_7, LOW); delay(100);
//5 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, HIGH); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//4 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, LOW); digitalWrite(led_4, HIGH); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
/3 digitalWrite(led_1, LOW); digitalWrite(led_2, LOW); digitalWrite(led_3, HIGH); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
//2 digitalWrite(led_1, LOW); digitalWrite(led_2, HIGH); digitalWrite(led_3, LOW); digitalWrite(led_4, LOW); digitalWrite(led_5, LOW); digitalWrite(led_6, LOW); digitalWrite(led_7, LOW); delay(100);
}