Having trouble with Nodemcu programming, first time with Blynk

I’d start by changing this line:

to this:
Serial.begin(74880);
as this is most likely the native baud rate of your NodeMCU, and you’ll see boot messages as well as your serial output without any gargled characters.

Then, in the Arduino IDE click this icon in the top right hand corner…

image

and set the baud rate to 74880.

Now, when you boot the device you should see some boot messages from the board, and some information messages from Blynk.

Pete.

Now currently on my serial monitor all i see is connecting to my wifi and after it connects it ends at ready and states the ping. I seriously do not know what to do after this

1 Like
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "4D9OLYSjbs-_ojg78CO8a0mzDRZIsUeI"; //eg8NNwEGGw04hU8Me9onpBci_SL50Wvp
char ssid[] = "yoon"; //yoon
char pass[] = "Jangyong123$"; //Jangyong1234$
int flag=0;



void notifyOnButtonPress()
{
  int isButtonPressed = digitalRead(D1);
  if (isButtonPressed==1 && flag==0) {
    Serial.println("Someone Opened the door");
    Blynk.notify("Alert : Someone Opened the door");
    flag=1;
  }
  else if (isButtonPressed==0)
  {
    flag=0;
  }
}
void setup()
{
Serial.begin(74880);
Blynk.begin(auth, ssid, pass);
pinMode(D1,INPUT_PULLUP);
timer.setInterval(16000L,notifyOnButtonPress); 
}
void loop()
{
  Blynk.run();
  timer.run();
}

This is my new code and i have followed your instructions however it is not working right now

Hi man, this is what came out. Unlike my previous ones, it indeed had the notification someone opened the door at the bottom, however, the notification did not come to phone.

load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v00046430
~ld
[65] Connecting to yoon
[6291] Connected to WiFi
[6291] IP: 192.168.18.11
[6291] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.0-beta.3 on ESP8266

[6301] Connecting to blynk-cloud.com:80
[6331] Ready (ping: 8ms).
Someone Opened the door

It sees that the codee is working well because in the serial monitor when i disconnect the reed switch the message someone opened the door will come up. The bad thing is that it doesn’t come up on my phone which is very weird

Did you insert the notification widget on your blynk app ?

2021-07-07_165255

You should be using library version 0.6.1

Pete.

1 Like

I use 1.0 but not beta with my old app :wink:

Yep. Thx for the tip

Hi Pete Knight how do i exactly change the library version to that?

In the Arduino IDE’s library manager.
It gives you the option to choose the version to up/downgrade to.

Pete.

1 Like

Hi pete
The project was previously successful and all was good. However, recently, the code has not been working although i have the latest libraries. The serial monitors also show this instead of showing that the code works.

ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v000463f0
~ld
[71] Connecting to yoon

If you’re using Legacy Blynk then you shouldn’t be using the latest library, as I said earlier you should be using 0.6.1

The sketch isn’t connecting to your WiFi

Pete.

Hi ma. I am using 0.6.1 and every other library is correct

Hi so what problem would my node mcu not connecting to wifi indicate

Wrong SSID or password (both are case sensitive)
WiFi network needs to be 2.4Ghz

Pete.

1 Like

Hi man, I’ll check that out today and update you on the coding

Hi man, my WiFi network is actually 5Ghz. However, the weird thing is that before today it worked perfectly at home
by the way this is my current code
[71] Connecting to yoon

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "4D9OLYSjbs-_ojg78CO8a0mzDRZIsUeI"; 
char ssid[] = "yoon"; //yoon
char pass[] = "Jangyong123$"; //Jangyong123$
int flag=0;

void notifyOnButtonPress()
{
  int isButtonPressed = digitalRead(D1);
  if (isButtonPressed==1 && flag==0) {
    Serial.println("Someone Opened the door");
    Blynk.notify("Alert : Someone Opened the door");
    flag=1;
  }
  else if (isButtonPressed==0)
  {
    flag=0;
  }
}
void setup()
{
Serial.begin(74880);
Blynk.begin(auth, ssid, pass);
pinMode(D1,INPUT_PULLUP);
timer.setInterval(16000L,notifyOnButtonPress); 
}
void loop()
{
  Blynk.run();
  timer.run();
}[71] Connecting to yoon

because the day before you had a 2.4Ghz wifi network :wink:
ESP8266 and ESP32 can’t work on 5 Ghz

It’s not possible for an ESP8266 or ESP32 to connect to a 5GHz WiFi network.
Maybe your router is/was broadcasting the same SSID on both frequencies…
Maybe you should start by rebooting your router, then if the problem persists checking its configuration.

Pete.

2 Likes

Hi man thanks. I rebooted my router and it reset bakc to 2.4Ghz. However, now when i upload the code it says
the selected serial port _
does not exist or your board is not connected

1 Like