#define LDR_PIN 35
const float GAMMA = 0.7;
const float RL10 = 50;
void setup() {
//make analog pin A0 as input
pinMode(LDR_PIN, INPUT);
//Serial.begin(9600); //initialize serial monitor
}
void loop() {
int analogValue = analogRead(LDR_PIN);
float voltage = analogValue / 1024. * 5;
float resistance = 2000 * voltage / (1 - voltage / 5);
float lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA));
Serial.println(lux);
}