blynkkk / blynk-sketch-generator

This repository is for generating Blynk sketches.
https://examples.blynk.cc
MIT License
25 stars 25 forks source link

Notification offline #87

Closed mmsmcgl closed 1 year ago

mmsmcgl commented 4 years ago

I am using an ESP-07S WiFi module and have been trying to use Blynk to send me a notification when I ground pin 2, as in their example code provided for "Push Button Notification". I turned on "Notify When Hardware Goes Offline", set a ringtone for my notification widget and uploaded the sketch provided. Then, every 5 seconds or so I get a "Your Notification Text Went Offline" text on my phone. I suspect this is happening because my conection with the Blynk servers keeps getting interrupted; but, I can't figure out why.
I have tried using pulldown resister and even grounding pin 2; but, I still get the same texts. Here is a copy of my sketch:

/ Comment this out to disable prints and save space /

define BLYNK_PRINT Serial

include

include

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

// Your WiFi credentials. // Set password to "" for open networks. char ssid[] = " secret "; char pass[] = " secret ";

void notifyOnButtonPress() { // Invert state, since button is "Active LOW" int isButtonPressed = !digitalRead(2); if (isButtonPressed) { Serial.println("Button is pressed.");

// Note:
//   We allow 1 notification per 15 seconds for now.
Blynk.notify("Yaaay... button is pressed!");

} }

void setup() { // Debug console Serial.begin(115200);

Blynk.begin(auth, ssid, pass); // You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

// Setup notification button on pin 2 pinMode(2, INPUT_PULLUP); // Attach pin 2 interrupt to our handler attachInterrupt(digitalPinToInterrupt(2), notifyOnButtonPress, CHANGE); }

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

Any help is appreciated.

vshymanskyy commented 1 year ago

Please use https://community.blynk.cc/