int buttonState = 0; void setup() { pinMode (D1, INPUT); pinMode(D2, OUTPUT); Serial.begin (9600); } void loop() { // read the state of the pushbutton value buttonState = digitalRead(D1) ; // check if pushbutton is pressed. if it is, the // buttonState is HIGH if (buttonState == HIGH) { // turn LED on digitalwrite(D2, HIGH); Serial.print("input is High"); } else { // turn LED off digitalwrite(D2, LOW); Serial. print ("input is low"); } delay(10); // Delay a little bit to improve simulation performance }