Blynk push notification not working

Hello i am new to BLynk community and i only have Python knowledge .
Its my first program with arduino and Blynk and i cant send push notification when a condition is met from my hardware to my app.
i am connected with wifi and my code is this

Arduino-MAX30100 oximetry / heart rate integrated sensor library
Copyright (C) 2016  OXullo Intersecans <>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <>.

#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#include <WiFiNINA.h>  /* libaries to connect our device with BLYNK */
#include <BlynkSimpleWiFiNINA.h> /* libaries to connect our device with BLYNK */
#define BLYNK_PRINT Serial
#define REPORTING_PERIOD_MS     1000
#define BLYNK_MAX_SENDBYTES 256 // Default is 128

// PulseOximeter is the higher level interface to the sensor
// it offers:
//  * beat detection reporting
//  * heart rate calculation
//  * SpO2 (oxidation level) calculation
PulseOximeter pox;
BlynkTimer timer;

char auth[] = "PpFpmZIUqh-STdTSYxIr3XWxvctPKroE";

// xD
char ssid[] = "WIND_2.4G_EAE3F3";
char pass[] = "a2109626858";
uint32_t tsLastReport = 0;

//simple and smart function to ignore first readings which are false and then check if Heart rate or Spo2 levels are abnormal , we ll call it outside of the loop because the IoT server gonna get overflooded with DATA , so we ll call with interval Time
void sendMsg()
float h=pox.getHeartRate();
float o=pox.getSpO2();

    if( h>=80)
       Blynk.notify("Your BpM is Quite High,I am Sending Data To you Doctor ");
     else if ( o<90)
       Blynk.notify("Your Spo2 is Quite Low,I am Sending Data To your Doctor ");
   else if(h<40)
     Blynk.notify("Your BpM is Quite Low,I am Sending Data To you Doctor ");
     Blynk.notify("Everything Looks Perfect");

// Callback (registered below) fired when a pulse is detected
void onBeatDetected()

void setup()
 Blynk.begin(auth, ssid, pass);

 Serial.print("Initializing pulse oximeter..");

 // Initialize the PulseOximeter instance
 // Failures are generally due to an improper I2C wiring, missing power supply
 // or wrong target chip
 if (!pox.begin()) {
 } else {

 // The default current for the IR LED is 50mA and it could be changed
 //   by uncommenting the following line. Check MAX30100_Registers.h for all the
 //   available options.
 // pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);

 // Register a callback for the beat detection

 timer.setInterval(5000, sendMsg);


void loop()
 // Make sure to call update as fast as possible


 // Asynchronously dump heart rate and oxidation levels to the serial
 // For both, a value of 0 means "invalid"
 if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
     Serial.print("Heart rate:");
     Serial.print("bpm / SpO2:");
// here what i did , is i am converting DIgital and ANALOG outputs to VIRTUAL so i can display them 
     Blynk.virtualWrite(5, pox.getHeartRate());
     Blynk.virtualWrite(4, pox.getSpO2());
     tsLastReport = millis();

Notification widget should be added in your app. If it is already added then delete and add again.

You seem to have gone a bit crazy with the opening and closing curly brackets.
Your void loop needs one pair at the beginning and end, and the if statement needs a pair too. The rest are not required, and I’m surprised they didn’t give you compiler errors.

Your timer won’t run unless you have:;
In your void loop.

Also, your void loop contains far too much stuff. Read this:



Pete was the solution and thank you.
Yes indeed i want to have a clean code , but i am used with Identations so excuse me for my curly brackets.
Thanks again

1 Like