Wemos D1 R2 Smart doorbell

Hi, i have this code that will upload to my Wemos board, but it is not sending me notifications like “Open the door”. But it is sending me that esp was disconnected. Does anyone know how to solve this problem? The original code is for arduino uno Here

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <pins_arduino.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxx";

SimpleTimer timer;

WidgetLCD lcd(V1);

void setup()
{ 
  
  Serial.begin(9600);
  Blynk.begin(auth, "xxxxx", "xxxxxx");
 
}
void notifyOnButtonPress()
{
  // Invert state, since button is "Active LOW"
  int isButtonPressed = !digitalRead(D5);
  if (isButtonPressed) {
    BLYNK_LOG("Button is pressed.");

    Blynk.notify("Please open up! Somebody is on the door!");
     lcd.clear(); //Use it to clear the LCD Widget
  lcd.print(4, 0, "Open"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
  lcd.print(4, 1, "The Door!");
  }
}
//
//void emailOnButtonPress()
//{
//
//  int isButtonPressed = !digitalRead(D2); // Invert state, since button is "Active LOW"
//
//  if (isButtonPressed) // You can write any condition to trigger e-mail sending
//  {
//    BLYNK_LOG("Button is pressed."); // This can be seen in the Serial Monitor
//    Blynk.email("xxxxx@gmail.com", "Subject: Doorbell", "Please open up! Somebody is on the door!");
//     lcd.clear(); //Use it to clear the LCD Widget
//  lcd.print(4, 0, "Open"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
//  lcd.print(4, 1, "The Door!");
//
//  }
//}

void loop()
{
  Blynk.run();
  timer.run();
}

Your code is not complete. As you never call notifyOnButtonPress.

how would you complete it? I have only basic coding knowladge :smiley:

void setup()
{  
// Setup a function to be called every second
  timer.setInterval(1000L, notifyOnButtonPress);
}

every function needs to be told to run, except loop and setup.

yeah, mine does that constantly too, but if it is disconnected, it still doesn’t seem to affect how the program works!

but i dont know why it disconnects, so i would kinda like to know too…

Thank you my leader :clap: it works!!