Student Page

Harold O. Levy Acceptable Use Policy

Student Handbook 17-18



Lightshow Arduino Code

int red1 = 13;
int yellow1 = 12;
int green1 = 11;
int red2 = 10;
int yellow2 = 9;
int green2 = 8;

void setup() {
// put your setup code here, to run once:

pinMode(red1, OUTPUT);
pinMode(yellow1, OUTPUT);
pinMode(green1, OUTPUT);
pinMode(red2, OUTPUT);
pinMode(yellow2, OUTPUT);
pinMode(green2, OUTPUT);

void loop() {
// put your main code here, to run repeatedly:

void lightshow(){
// green off, yellow on for 3 seconds
digitalWrite(green1, LOW);
digitalWrite(yellow1, HIGH);

// turn off yellow, then turn red on for 5 seconds
digitalWrite(yellow2, LOW);
digitalWrite(red2, HIGH);

// red and yellow on for 2 seconds (red is already on though)
digitalWrite(yellow1, HIGH);

// turn off red and yellow, then turn on green
digitalWrite(yellow2, LOW);
digitalWrite(red2, LOW);
digitalWrite(green2, HIGH);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: