int led=8;
int swi=9;
void setup()
{
pinMode(led, OUTPUT);
pinMode(swi,INPUT_PULLUP);
Serial.begin(9600); // put your setup code here, to run once:
}
void loop()
{
int status=digitalRead(swi);
Serial.println(status);
if(status==HIGH)
{
digitalWrite(led,LOW);
Serial.println("led is off");
}
else {
digitalWrite(led, HIGH);
Serial.println("led is on");
}
}