int led=8;
int swt=9;
void setup() {
pinMode(led, OUTPUT);
pinMode(swt, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
int sts=digitalRead(swt);
Serial.println(sts);
if (sts==HIGH)
{
digitalWrite(led, LOW);
Serial.println("led off");
}
else{
digitalWrite(led, HIGH);
Serial.println("led on");
}
}