0% found this document useful (0 votes)
16 views4 pages

Velammal Code

The document provides code examples for using an ESP32 with Blynk cloud to interface with both analog and digital sensors. It includes setup for reading an analog sensor, converting the value to Celsius, and sending it to Blynk, as well as controlling a digital output based on Blynk commands. The code is structured with necessary libraries, WiFi credentials, and Blynk authentication tokens for both sensor types.

Uploaded by

jaisuryajs26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Velammal Code

The document provides code examples for using an ESP32 with Blynk cloud to interface with both analog and digital sensors. It includes setup for reading an analog sensor, converting the value to Celsius, and sending it to Blynk, as well as controlling a digital output based on Blynk commands. The code is structured with necessary libraries, WiFi credentials, and Blynk authentication tokens for both sensor types.

Uploaded by

jaisuryajs26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Analog sensor with ESP32 and Blynk cloud:

#define BLYNK_TEMPLATE_ID "TMPL3osVC2bRd"

#define BLYNK_TEMPLATE_NAME "TEST"

#define BLYNK_AUTH_TOKEN "-gXdyKSOqZpZlKDv5zf24gb7lxU3tXFG"

#include <WiFi.h>

#include <BlynkSimpleEsp32.h>

char auth[] = "-gXdyKSOqZpZlKDv5zf24gb7lxU3tXFG";

char ssid[] = "moto g04s";

char pass[] = "jzg667s2j277fnb";

#define PIN_UPTIME V6

BLYNK_READ(PIN_UPTIME)

Blynk.virtualWrite(PIN_UPTIME, millis() / 1000);

BlynkTimer timer;

void myTimerEvent()

int analogValue = analogRead(36); //reading the sensor on A0

float millivolts = (analogValue/1024.0) * 3300; //3300 is the voltage provided by NodeMCU

float celsius = millivolts/10;

Blynk.virtualWrite(V0, celsius); //sending to Blynk

}
void setup()

Serial.begin(9600);

Blynk.begin(auth, ssid, pass);

timer.setInterval(1000L, myTimerEvent);

void loop()

Blynk.run();

timer.run(); // Initiates BlynkTimer

Digital sensor with BLYNK CLOUD and ESP32:

#define BLYNK_TEMPLATE_ID "TMPL_x4__uBM"

#define BLYNK_DEVICE_NAME "Raja"

#define BLYNK_AUTH_TOKEN "5bboiWtqnFoKCy3-pp5v5HS11JIJE9dD"

#define BLYNK_PRINT Serial

#include <WiFi.h>

#include <BlynkSimpleEsp32.h>

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "Redmi 9A";

char pass[] = "arthyraja";


BlynkTimer timer;

BLYNK_WRITE(V0)

int value = param.asInt();

if(value==1)

digitalWrite(D0,HIGH);

else

digitalWrite(D0,LOW);

}}

BLYNK_CONNECTED()

Blynk.syncVirtual(V0);

//void myTimerEvent()

//{

// Blynk.virtualWrite(V2, millis() / 1000);

//}

void setup()

pinMode(D0,OUTPUT);
Serial.begin(9600);

Blynk.begin(auth, ssid, pass);

//timer.setInterval(1000L, myTimerEvent);

void loop()

Blynk.run();

timer.run();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy