#define ldrPin 0
#define ntcPin 2
const float RL10 = 50;
const float GAMMA = 0.7;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
analogReadResolution(12);
}
void loop() {
// put your main code here, to run repeatedly:
int analogLDRValue = analogRead(ldrPin);
float voltage = analogLDRValue / 4096. * 5;
float resistance = 2000 * voltage / (1 - voltage / 5);
float lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA));
Serial.println(lux);
delay(100); // this speeds up the simulation
}