#define LED1 22
#define SWITCH1 18
void setup() {
pinMode(LED1, OUTPUT);
pinMode(SWITCH1, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
int buttonstate=digitalRead(SWITCH1);
if (buttonstate == 0){
digitalWrite(LED1, HIGH);
Serial.println("Swithch ON, LED ON");
}
else if (buttonstate ==1){
digitalWrite(LED1,LOW);
Serial.println("Swith OFF, LED OFF");
}
}