int led=8;
int sw=10;
void setup() {
// put your setup code here, to run once:
pinMode(led, OUTPUT);
pinMode(sw, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int status = digitalRead(sw);
Serial.println(status);
if(status==HIGH)
{
digitalWrite(led, HIGH);
Serial.println("led is ON");
}
else
{
digitalWrite(led, LOW);
Serial.println("led is OFF");
}
}