Assignment 2.1
Post date: Jul 25, 2010 9:46:28 PM
Worked on this for awhile. It took some time figuring out how everything worked.
int led13 = 13; //sets variables for the sketch
int led12 = 12;
int led11 = 11;
int led10 = 10;
int led9 = 9;
void setup() {
pinMode(led13, OUTPUT); //intalizes digital pins 9-13 as outputs
pinMode(led12, OUTPUT);
pinMode(led11, OUTPUT);
pinMode(led10, OUTPUT);
pinMode(led9, OUTPUT);
}
void loop()
{
digitalWrite(led13, HIGH);// turn LED#13 on
digitalWrite(led11, HIGH);//turn LED#11 on
digitalWrite(led9, HIGH);//turn LED#9 on
delay(500); //wait for half a second
digitalWrite(led13, LOW);//turn LED#13 off
digitalWrite(led11, LOW);//turn LED#11 off
digitalWrite(led9, LOW);//turn LED#9 off
digitalWrite(led12, HIGH);//turn LED#12 on
digitalWrite(led10, HIGH);//turn LED#10 on
delay(500);//wait for half a second
digitalWrite(led12, LOW);//turn LED#12 off
digitalWrite(led10, LOW);//turn LED#10 off
digitalWrite(led13, HIGH);//turn LED#13 on
digitalWrite(led11, HIGH);//turn LED#11 on
digitalWrite(led9, HIGH);//turn LED#9 on
delay(500);//wait for half a second
digitalWrite(led13, LOW);//turn LED#13 off
digitalWrite(led11, LOW);//turn LED#11 off
digitalWrite(led9, LOW);//turn LED#9 off
digitalWrite(led12, HIGH);//turn LED#12 on
digitalWrite(led10, HIGH);//turnLED#10 on
delay(500);//wait for half a second
digitalWrite(led12, LOW);//turn LED#12 off
digitalWrite(led10, LOW);//turn LED#10 off
delay(500);//wait for half a second
digitalWrite(led13, LOW);//turn LED#13 off
digitalWrite(led12, LOW);//turn LED#12 off
digitalWrite(led11, LOW);//turn LED#11 off
digitalWrite(led10, LOW);//turn LED#10 off
digitalWrite(led9, LOW);//turn LED#9 off
delay(500);//wait for half a second
digitalWrite(led13, HIGH);//turn LED#13 on
digitalWrite(led12, HIGH);//turn LED#12 on
digitalWrite(led11, HIGH);//turn LED#11 on
digitalWrite(led10, HIGH);//turn LED#10 on
digitalWrite(led9, HIGH);//turn LED#9 on
delay(500);//wait for half a second
digitalWrite(led13, LOW);//turn LED#13 off
digitalWrite(led12, LOW);//turn LED#12 off
digitalWrite(led11, LOW);//turn LED#11 off
digitalWrite(led10, LOW);//turn LED#10 off
digitalWrite(led9, LOW);//turn LED#9 off
delay(500);//wait for half a second
}