My blynk is not send notification

#define BLYNK_DEVICE_NAME "----"
#define BLYNK_AUTH_TOKEN "----"

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include "MAX30100_PulseOximeter.h"
#include <SimpleTimer.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char auth[] = BLYNK_AUTH_TOKEN ;             // You should get Auth Token in the Blynk App.
char ssid[] = "---i";                                     // Your WiFi credentials.
char pass[] = "----";


#define REPORTING_PERIOD_MS     3000
SimpleTimer timer;
 
PulseOximeter pox;
uint32_t tsLastReport = 0;

void onBeatDetected()
{
    ;
}

// for the OLED display

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
 
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup()
{
    Serial.begin(115200);
    //Wire.begin(D2, D1);//sda,scl
    Blynk.begin(auth, ssid, pass);
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
    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()) {
        Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
        digitalWrite(1,HIGH);
    }
     pox.setIRLedCurrent(MAX30100_LED_CURR_24MA);
 
    // Register a callback for the beat detection
    pox.setOnBeatDetectedCallback(onBeatDetected);

   timer.setInterval(3000L, getSendData);

     display.clearDisplay();
  display.setTextColor(WHITE);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, pass);

  int a = 0;
    while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    display.setCursor(a, 0);
    display.print(".");
    delay(500);
    a++;
    }
    Serial.println("");
    display.clearDisplay();
    display.setTextSize(1);                    
    display.setTextColor(WHITE); 
    display.setCursor(0, 0);
    display.print("WiFi connected");
    Serial.println("WiFi connected");
    Serial.print("IP address: ");
    display.setCursor(0, 1);
    display.print(WiFi.localIP());
    Serial.println(WiFi.localIP());
    delay(500);


 //Blynk.begin();
 //WiFi.begin(ssid, pass);
 //timer.setInterval(2000L, checkBlynkStatus); 
 Blynk.begin(auth, ssid, pass);  
 delay(1000);
}
 
void loop()
{

  timer.run(); // Initiates SimpleTimer
  Blynk.run();

  float Hr = pox.getHeartRate();
  float SpO2 = pox.getSpO2(); 
  //float temp = mlx.readObjectTempC();
// Make sure to call update as fast as possible
  pox.update();
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {


  // to android cell phone application
        Serial.print("BPM: ");
        Serial.print(pox.getHeartRate());
        //blue.println("\n");
        
        Serial.print("SpO2: ");
        Serial.print(pox.getSpO2());
        Serial.print("%");
        Serial.println("\n");

      Blynk.virtualWrite(V0,pox.getHeartRate() );
      if(Hr <= 50 ){
       Blynk.notify("Low Heart Rate Alert");
        //bot.sendMessage(CHAT_ID, "Low Heart Rate Alert!!", "");
        }
        if(Hr >= 150){
        Blynk.notify("High Heart Rate Alert!!");  
        //bot.sendMessage(CHAT_ID, "High Heart Rate Alert!!", "");
        }
        Blynk.virtualWrite(V1,pox.getSpO2());
        if(SpO2 <=93){
        Blynk.notify("SpO2 Abnormal Alert"); 
        //bot.sendMessage(CHAT_ID, "SpO2 Abnormal Alert", "");
        }

        


        tsLastReport = millis();
        
    }
}





void getSendData()
{
  
        
// Oled display
  display.clearDisplay();
  // display R G B Values
  display.setTextSize(2);
  display.setCursor(0,0); // column row
  display.print("BPM:");

  display.setTextSize(2);
  display.setCursor(55, 0);
  display.print(pox.getHeartRate());

  

    display.setTextSize(2);
  display.setCursor(0,50);
  display.print("SpO2:");

  display.setTextSize(2);
  display.setCursor(60, 50);
  display.print(pox.getSpO2());
  display.setCursor(95, 50);
  display.print("%");
 display.display(); 

 
}

First of all, you should read this

Blynk.notify has been replaced with Blynk.logEvent

1 Like

i already change to Blynk.logEvent but it still didn’t send notification

You need to:

  1. Use existing or create new event in your template.
  2. Enable notifications for that event.
  3. in Blynk.logEvent use appropriate event’s id.

If all above has been done - check Blynk app’s Settings screen in case you have disabled notifications.

Posting your updated code would be a good starting point.
It would also be a good idea to post a screenshot showing how you’ve configured the event you’ve set-up for this, both the General and the Notifications tabs for that event.

Reading this tutorial is probably a good idea too…

Pete.