Push button notification on Raspberry Pi 3

Hi there friends, first i’m apologizing for my english, cuz i’m from Brazil. So, I’m new with raspberry and blynk and i’m working in a project that i need to send a notification to Blynk App when i press a physical button on raspberry. I already searched in many places, tryed to use phyton, js and now i’m trying to use C++ with the help of this tutorial: Using C++ on a Raspberry Pi with Blynk. But i still can’t send a notification to my App. I already set the button to turn a GIPO output to high and i tryed to read this GPIO status in the C++, but no successfull. Can anyone help me with that ? I set the GPIO 4 to receive the button status and the GPIO as OUTPUT. I also tryed the sketch of the above link, but it doesn’t work: https://examples.blynk.cc/?board=Raspberry%20Pi&shield=System%20default&example=Widgets%2FPushNotification%2FPushNotification_Button

Hi Costas, i’m working in a project with Raspberry pi3 and i need to send a notification to my Blynk App when a Output (GIPO 22) goes high. I tryed almost everything but i can’t read the GPIO status and send the notification. Can you help me with a little sketch using the C++ as you done? I just need to receive a notification in my App when the GPIO 22 goes high.

@superot the sketch I originally provided reads a data pin with:

pinStatus = digitalRead(17);

Have you tested the original sketch before making the changes for your particular requirement?

Ensure you fully understand the 3 or 4 pin numbering systems used by the Raspberry Pi.

yeah, i’ve tested this sketch https://examples.blynk.cc/?board=Raspberry%20Pi&shield=System%20default&example=Widgets%2FPushNotification%2FPushNotification_Button
but when i run the script it doesnt identify some codes like: attachInterrupt and CHANGE. I conected the button to GPIO 2 is it correct?

I also made some changes in your code, cuz it doesn’t working. Here is my code, i’m reading the Output GPIO 22. (i made another script to turn this output High when i press the button).

// Blynk "gp" numbers are BCM numbers, so gp17 is physical pin 11 
// #define BLYNK_DEBUG
#define BLYNK_PRINT stdout
 #include <BlynkApiWiringPi.h>
 #include <BlynkApiLinux.h>
#include <BlynkSocket.h>
#include <BlynkOptionsParser.h>

static BlynkTransportSocket _blynkTransport;
BlynkSocket Blynk(_blynkTransport);

#include <BlynkWidgets.h>

int pinStatus;   		

void myTimerEvent()       		
  pinStatus = digitalRead(22);
  if(pinStatus == 1){
	Blynk.notify("Yaaay... button is pressed!");

void setup()
  //nothing to go here yet

void loop()

int main(int argc, char* argv[])
    const char *auth, *serv;
    uint16_t port;
    parse_options(argc, argv, auth, serv, port);
    Blynk.begin(auth, serv, port);
    while(true) {
    return 0;

@superot I’m too busy with our own project at the moment to look at other people’s code but I can probably take a look in a few weeks if you are still struggling. The sketch has some comments regarding Pi pin numbering and many users get them mixed up like they do with ESP’s when they move on from Arduinos.