For the ESP8266 and PIR module to work with the defined Blynk application, it includes the Blynk header, the Simple timer, and defines the BLYNK_PRINT as serial for debugging purposes. You need to run the following code:
#define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <SimpleTimer.h>
Go to the Mobile application and then to Project Settings and email yourself the app_token:
char app_token = "TOKEN_FROM_EMAIL"; SimpleTimer timer; char ssid = "YOUR_WIFI_NETWORK"; char pass = "YOUR_PASSWORD"; int state; int counter=0; int flag=1; WidgetLED led1(V1); WidgetLED pirLED(V2);
This is the timer function that will be called every second to check the status of the PIR ...