Sensor value are not sent to Blynk

I’m working on a project that requires a value to be taken from sensor connected with arduino, then sent the value to NodeMCU through Serial , then the same value again to the Blynk app. But I’m having problem as it didnt send the same value from arduino to Blynk. From arduino to NodeMCU, I managed to send the same value, but it seems that NodeMCU cannot sample the same received value to be resend to Blynk. Below is the code which I uploaded on NodeMCU, the code on Arduino is not uploaded since I think it’s not wrong. I felt like I’m missing something in the NodeMCU code. Please help me solve this issue.

#define BLYNK_PRINT Serial

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "19db9b6385ca4c9e818e82f5576379be";
int myBPM;
char ssid[] = "Lolol";
char pass[] = "popopopo";

BlynkTimer timer;
void myTimerEvent()
  while (Serial.available() > 0) {
    sensorBPM(); }
  Blynk.notify("BPM is HIGH!");

void setup()
  while (!Serial) {
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, myTimerEvent);

void loop()

void sensorBPM()
   myBPM =;

You’ve said that the values seen on the NodeMCU are different to those on the Arduino, but you’ve not given any examples.

Your NodeMCU code seems odd in several ways…

The ‘while’ code in your myTimerEvent function is blocking. This means that the code will stall at that point until the while criteria is met. This will causeBlynk disconnections.

The myTimerEvent function also sends the notification “BPM is HIGH!” regardless of what the BPM value is. If this function operates correctly (without any blocking) then because it’s being called every second it will try to send this notification once every second, but notifications are limited to one every 5 seconds.