#define pin A0
#define pinled 7
int lux=0;
const float GAMMA = 0.7; // Ignore - not important for IT students
const float RL10 = 50; // Ignore - not important for IT students
void setup() {
Serial.begin(9600);
pinMode(pinled,OUTPUT);
}
void loop() {
lux = analogRead(pin);
float voltage = lux / 1024. * 5; // Ignore - not important for IT students
float resistance = 2000 * voltage / (1 - voltage / 5); // Ignore - not important for IT students
float lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA)); // Ignore - not important for IT students
Serial.println(lux);
if (lux >= 200)
digitalWrite(pinled,HIGH);
else
digitalWrite(pinled,LOW);
}