#define BLYNK_WRITE Serial
#define BLYNK_TEMPLATE_ID "TMPLL-FoykxF"
#define BLYNK_AUTH_TOKEN "Qjen4HF5fJNV5XQ9XmNlMMG0L-owwBca"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
const float GAMMA = 0.7;
const float RL10 = 50;
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BlynkTimer timer;
void sendLux()
{
int analogValue = analogRead(35);
float voltage = analogValue * 5/4095.0;
float resistance = 2000 * voltage / (1 - voltage / 5);
float lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA));
Serial.print("Lux: ");
Serial.println(lux);
Blynk.virtualWrite(V1, lux);
}
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, sendLux);
}
void loop() {
Blynk.run();
timer.run();
}