today:
1. review your work from yesterday – get caught up, including uploading video
2. the Stoplight Field Trip
3. Next up – incorporating a switch and taking control.
Your mission is to setup the board and Arduino to match the photos below. Then copy/paste the code into Arduino. Compile and upload. Troubleshoot.
Then take the the code and comment each line to tell us what is happening. Comment like this:
//this tells the yellow light to turn on
The breadboard/Arduino controller setup
and the code:
void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(2, INPUT);
}
void loop() {
if(digitalRead(2) == HIGH){
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
delay(3000);
digitalWrite(13,LOW);
digitalWrite(11,HIGH);
} else{
digitalWrite(11, HIGH);
delay(100);
}
}

