const int buttonPin = D2; // pushbutton pin const int ledPin = D3; // LED pin int buttonState = 0; void setup() { Serial.begin(115200); // enable internal pull-up resistor pinMode(buttonPin, INPUT_PULLUP); // LED output pinMode(ledPin, OUTPUT); } void loop() { // read the state of the pushbutton (LOW = pressed) buttonState = digitalRead(buttonPin); Serial.println(buttonState); Serial.println("Welcome to my domain"); // button pressed? if (buttonState == HIGH) { // active LOW digitalWrite(ledPin, HIGH); // turn LED on } else { digitalWrite(ledPin, LOW); // turn LED off } delay(1000); }