Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BLYNK_AUTH_TOKEN ""
- #define BLYNK_TEMPLATE_ID ""
- #define BLYNK_TEMPLATE_NAME "Wireless Transmission"
- #define BLYNK_PRINT Serial
- #include <BlynkSimpleEsp32.h>
- #include <WiFi.h>
- #include <WiFiClient.h>
- char auth[] = BLYNK_AUTH_TOKEN;
- char pass[] = "";
- char ssid[] = "@177013";
- BlynkTimer timer;
- const int sensor_pin = 34;
- const int led_pin = 2;
- void send_sensor() {
- int val = (analogRead(sensor_pin) * 255) / 4095;
- Serial.printf("Sensor: %d\n", val);
- Blynk.virtualWrite(V1, val);
- }
- void setup() {
- Serial.begin(115200);
- WiFi.begin(ssid, pass);
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("\nWiFi connected");
- Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
- // schedule every 5s
- timer.setInterval(5000L, send_sensor);
- }
- void loop() {
- Blynk.run();
- timer.run();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement