/* This simulation shows the difference between a
  simple electical switch (below the board),
  and a programable switch (above the board).
  Press the green play button to begin the simulation.
  The programmable switch is NOT connected to the light, only the board.
  The simple switch is not prgrammable. This is like an ordinary light switch.
*/


//the int terms are variables that can be changed.
int switchL = 0;  // variable for switch in left position.
int switchR = 0;  // variable for switch in right position.
int on = 1;       // on is translated to the value 1 (which is on or HIGH)
int off = 0;      // off is translated to the value 0

void setup() {
  pinMode(9, INPUT_PULLUP);   // right of switch is attached to pin 9. Inputs are read.
  pinMode(10, INPUT_PULLUP);  // left of switch is attached to pin 10.
  pinMode(6, OUTPUT);         // light is connected to pin 6. This sends singnal out.
}

void loop() {
  // left and right switch variables are read and changed to zero or one.
  int switchL = digitalRead(10);
  int switchR = digitalRead(9);

  // left switch is simply on or off.
  if (switchL == 1) {   // the condition is either true of false.
    digitalWrite(6, on);  // if it's tue, the light is on.
  }
  else {
    digitalWrite(6, off); // if it's false, the light is off.
  }

  // right switch flashes or is off.
  if (switchR == 1) {
    digitalWrite(6, on);
    delay(1000);
    digitalWrite(6, off);
    delay(1000);
  }
  else {
    digitalWrite(6, off);
  }


}