0% found this document useful (0 votes)
19 views2 pages

Cylon Flashing Circuit Code - Mariam, Lauren

The document contains Arduino code for a final project that simulates a Cylon flashing sequence using six red LED lights. It initializes the LED pins, sets them as outputs, and defines a loop to turn the LEDs on and off in a specific sequence with delays. The code aims to replicate the timing of the flashing seen in the Cylon head mount video.

Uploaded by

mariamssamdani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Cylon Flashing Circuit Code - Mariam, Lauren

The document contains Arduino code for a final project that simulates a Cylon flashing sequence using six red LED lights. It initializes the LED pins, sets them as outputs, and defines a loop to turn the LEDs on and off in a specific sequence with delays. The code aims to replicate the timing of the flashing seen in the Cylon head mount video.

Uploaded by

mariamssamdani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Final project code - Mariam, Lauren

/*
Name: Final Project - Cylon Flashing Circuit

Function: Rund 6 red LED lights to create a flashing sequence to mimic the timing of the
flashing in the Cylon head mount video.
*/

// Initialize variables
int ledDelay = 200; // long delay
int redPin1 = 8; // Use pin 8 for red 1
int redPin2 = 9; // Use pin 9 for red 2
int redPin3 = 10; // Use pin 10 for red 3
int redPin4 = 11; // Use pin 11 for red 4
int redPin5 = 12; // Use pin 12 for red 5
int redPin6 = 13; // Use pin 13 for red 6

// Setup Arduino digital pins as outputs so they can provide voltage


void setup() {
pinMode(redPin1, OUTPUT);
pinMode(redPin2, OUTPUT);
pinMode(redPin3, OUTPUT);
pinMode(redPin4, OUTPUT);
pinMode(redPin5, OUTPUT);
pinMode(redPin6, OUTPUT);
} //exit setup

void loop() { // loop executes continuously


digitalWrite(redPin1, HIGH); // turn red 1 on
digitalWrite(redPin2, HIGH); // turn red 2 on
delay(ledDelay); // long delay

digitalWrite(redPin1, LOW); // turn red 1 off


digitalWrite(redPin3, HIGH); // turn red 3 on
delay(ledDelay); // long delay

digitalWrite(redPin2, LOW); // turn red 2 off


digitalWrite(redPin4, HIGH); // turn red 4 on
delay(ledDelay); // long delay

digitalWrite(redPin3, LOW); // turn red 3 off


digitalWrite(redPin5, HIGH); // turn red 5 on
delay(ledDelay); // long delay

digitalWrite(redPin4, LOW); // turn red 4 off


digitalWrite(redPin6, HIGH); // turn red 6 on
delay(ledDelay); // long delay

digitalWrite(redPin6, LOW); // turn red 6 off


digitalWrite(redPin4, HIGH); // turn red 4 on
delay(ledDelay); // long delay

digitalWrite(redPin5, LOW); // turn red 5 off


digitalWrite(redPin3, HIGH); // turn red 3 on
delay(ledDelay); // long delay

digitalWrite(redPin4, LOW); // turn red 4 off


digitalWrite(redPin2, HIGH); // turn red 2 on
delay(ledDelay); // long delay

digitalWrite(redPin3, LOW); //turn red 3 off


} // exit loop

You might also like