Image

Homework 02 -SOS- Dennis MacAvaney

29 Oct

Assignment 02 -SOS- Dennis MacAvaney

int red=3; //”SOS” is signed with 3 short signals, 3 long, and then 3 short again
int blue=5; //this is the same setup as the RGB example in class
int green=6;
int count=0; //this will keep track of how many times a light flashes in each loop

void setup(){
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);

}

void loop(){

for(count=0;count=3, and
digitalWrite(red, HIGH); //count will go up by 1 at the end of each iteration (“count++”)
digitalWrite(blue, HIGH); //This is the first short-signal loop
digitalWrite(green, HIGH);
delay(500);
digitalWrite(red, LOW);
digitalWrite(blue, LOW);
digitalWrite(green, LOW);
delay(250);
}

delay(250);

for(count=0;count<3;count++) //3 long signals
{
digitalWrite(red, HIGH);
digitalWrite(blue, HIGH);
digitalWrite(green, HIGH);
delay(1000);
digitalWrite(red, LOW);
digitalWrite(blue, LOW);
digitalWrite(green, LOW);
delay(500);
}

for(count=0;count<3;count++) //3 short signals
{
digitalWrite(red, HIGH);
digitalWrite(blue, HIGH);
digitalWrite(green, HIGH);
delay(500);
digitalWrite(red, LOW);
digitalWrite(blue, LOW);
digitalWrite(green, LOW);
delay(250);
}

delay(750); //a delay at the end before SOS is signaled again

}

Advertisements

One Response to “Homework 02 -SOS- Dennis MacAvaney”

  1. justinberken October 29, 2013 at 10:43 pm #

    Nice work Dennis, I see a “for” loop in there!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s