// if - else sample code void setup() { // put your setup code here, to run once: pinMode(13,OUTPUT); pinMode(12,INPUT); pinMode(11,OUTPUT); } void loop() { // put your main code here, to run repeatedly: if (digitalRead(12) == HIGH) { //do stuff digitalWrite(13,HIGH); digitalWrite(11,LOW); } else { //do other stuff digitalWrite(13,LOW); digitalWrite(11,HIGH); } }