/*
P01_LED_Control
Crowtail - bright led connect to D3 port
Crowtail - switch connect to D2 port
*/

int ledPin = 3;   //declare the variable of led pin
int switchPin = 2;    //declare the variable of switch pin
int switchState=0;    //declare the variable of switch state
// the setup routine runs once when you press reset:           
void setup() {                
  // initialize the led pin as an output.
  pinMode(ledPin, OUTPUT);  
  // initialize the switch pin as an input. 
  pinMode(switchPin, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
    switchState = digitalRead(switchPin);
     // check if the switch is pressed.
     // if it is, the switchState is HIGH:
   if (switchState == HIGH) {     
       // turn LED on:    
       digitalWrite(ledPin, HIGH);  
      } 
    else {
       // turn LED off:
       digitalWrite(ledPin, LOW); 
   }
}
