int LED_PIN = 12;
int SWITCH_PIN = 2;
bool switchState = false;
void setup() {
// put your setup code here, to run once:
pinMode(LED_PIN, OUTPUT); // LED
pinMode(SWITCH_PIN, INPUT); // SWITCH
}
void loop() {
// put your main code here, to run repeatedly:
switchState = digitalRead(SWITCH_PIN);
if(switchState == HIGH){
// Turn on the led
digitalWrite(LED_PIN, HIGH);
}else{
digitalWrite(LED_PIN, LOW);
}
}