void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(12, OUTPUT);
pinMode(23, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
int a=digitalRead(23);
if (a==1)
{
Serial.println("light on");
digitalWrite(12, HIGH);
delay(1000);
}
else
{
Serial.println("light off");
digitalWrite(12, LOW);
delay(1000);
}
}1