Alarming blynk app,when nodeMCU commands to

hello beautiful people!
I was just trying to do this:
have a sensor, may be mic or noise sensor,connected to nodeMCU,
when it gets prompted, my blynk app would alarm…
what i tried so far is uploading push notifications sketch or using eventer thing…but with no success
can someone help me here…i am really not good with blynk…
any effort is appreciated…

Can you post your code that you have so far? (Remove your auth token before publishing though :wink: )

thanks JustBertC for your reply,

here’s push notifications:

#define BLYNK_PRINT Serial
int pin =D2;

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

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

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

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

    // You can also use {DEVICE_NAME} placeholder for device name,
    // that will be replaced by your device name on the server side.
    //Blynk.notify("Yaaay... {DEVICE_NAME}  button is pressed!");

void setup()
  // Debug console
//  char ssid[10],pass[20];
//   ssid="corph";
//   pass="corph@corph";

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

void loop()
and here's esp8266 standalone:
  Download latest Blynk library here:

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials:
    Sketch generator: 
    Blynk community:  
    Follow us:        

  Blynk library is licensed under MIT license
  This example code is in public domain.

  This example runs directly on ESP8266 chip.

  Note: This requires ESP8266 support package:

  Please be sure to select the right ESP8266 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

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

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

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

void setup()
  // Debug console

  Blynk.begin(auth, ssid, pass);

void loop()

I’ve added triple backticks to the beginning and end of your code so that it displays correctly.
Please add them yourself in future otherwise your code will be deleted.
Triple backticks look like this:

I’d you’re connecting a microphone to a digital pin then you’re not likely to get any useable results.


1 Like

thanks Pete
ya, thats what i meant, i want mic or noise sensor,therefore i have to use Analog pin…

You could use one of these, and it would allow you to utilize a digital pin. You could then easily use the example sketch.


Have you tried the Mic on an analog pin without any Blynk code? If not then try that and you can see what values you’re getting (if any - you may need an amp circuit too) and then get back to us :+1:

[quote=“JustBertC, post:7, topic:37642”]
oo) and then get ba
thank you everybody for the reply
but mic is not an issue, i think i can deal with that…my concern is software part…

if I well understand , he put a button on pin D2, but the notification does not work
Blynk.notify(“Yaaay… button is pressed!”);

do you see that in your serial monitor “Button is pressed”?

PIN D2 is GPIO4, try interruptPin = 4

Maybe you could try to change “D2” to “4”? Try using the ESP numbering system rather than nodemcu

1 Like

thanks for your reply
i see that…
also, i havent used sensor or mic yet, i just tried to connect pin D2 to gnd or 3v, still no result…

so if you see, Button is pressed, the probleme is blynk notification
you need the notification widget on your app


but still,that is the problem

1 Like

sorry, I can’t help you anymore :thinking:

oh i am sorry, i didnt see that picture you had uploaded…
i already have that widget on my blynk app, it notifies only when nodeMCU is powered on or off