/*
Blynk example
You should get Auth Token in the Blynk App.
You need to write the right wifiCredentials.
*/
/* Comment this out to disable prints and save space */
#define BLYNK_TEMPLATE_ID "TMPL68XIhHw8R"
#define BLYNK_TEMPLATE_NAME "Motion sensor"
#define BLYNK_AUTH_TOKEN "SJsuT8pRgBVZuS2Riy4s95gn11WQmYZd"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
int motion_sensor=14;
int motion_data=0;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BlynkTimer timer;
void sendSensor()
{
int motion_data=digitalRead(motion_sensor);
Serial.println(motion_data);
delay(200);
Blynk.virtualWrite(V0, motion_data);
delay(300);
}
void setup() {
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(100L, sendSensor);
}
void loop() {
Blynk.run();
timer.run();
}