LED's
Touching wires and breadboards is good for the CS major.
Quote from page description is from Eric.
Code
// Pin 3: Input for reading button
// Pin 2: Output for controlling LED
int button_value = 0;
int BUTTON = 3;
int LED1 = 2;
int LED2 = 4;
void setup() {
// put your setup code here, to run once:
pinMode(BUTTON, INPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
button_value = digitalRead(BUTTON);
// button not pressed, based on my hardware implementation
if (button_value == 0){
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
} else {
digitalWrite(LED1, HIGH);
digitalWrite(LED2, LOW);
delay(100);
digitalWrite(LED1, LOW);
digitalWrite(LED2, HIGH);
delay(100);
}
}