#include #include #define PIN_BUTTON XX int state_btn = HIGH; const char* wifi_ssid = "xxxx"; const char* wifi_password = "xxxx"; void setup() { pinMode(PIN_BUTTON,INPUT_PULLUP); Serial.begin(9600); //starts serial monitor WiFi.mode(WIFI_STA); WiFi.begin(wifi_ssid, wifi_password); Serial.print("Connecting to WiFi.."); //writes the text on serial monitor while (WiFi.status() != WL_CONNECTED) { Serial.print('.'); delay(1000); } Serial.println(""); Serial.println(WiFi.localIP()); } void loop() { // put your main code here, to run repeatedly: int state_new = digitalRead(PIN_BUTTON); if (state_btn && !state_new) { Serial.println("pressed"); } state_btn = state_new; delay(1); }