#define BLYNK_TEMPLATE_ID "TMPL3ybIZXHSE"
#define BLYNK_TEMPLATE_NAME "sanjeev jesu"
#define BLYNK_AUTH_TOKEN "xYv4yOCvF3HEpq-_N-3zWsvYD35lzy9j"
// Include the correct Blynk library for your platform
#include <BlynkSimpleEsp32.h> // Use this if you're using an ESP32
// Wi-Fi credentials
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
// Define the analog pin to read data from (GPIO34)
int analogPin = 34; // Change according to your setup
int sensorValue = 0; // Variable to store the analog value
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
// Start Wi-Fi connection
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Connected to Wi-Fi!");
// Start Blynk connection
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// Setup the analog input pin
pinMode(analogPin, INPUT);
}
void loop() {
// Read the analog value from the sensor
sensorValue = analogRead(analogPin);
// Print the sensor value to Serial Monitor (for debugging)
Serial.print("Analog Value: ");
Serial.println(sensorValue);
// Send the analog value to the Blynk app on Virtual Pin V1
Blynk.virtualWrite(V1, sensorValue);
// Run the Blynk process (keep the connection alive)
Blynk.run();
// Add a small delay to control the frequency of updates
delay(1000); // Update every 1 second
}