// Set GPIO0 pin as analog input
const int photoresistorPin = 0;
void setup() {
// Initialize serial communication to display the read values
Serial.begin(115200);
}
void loop() {
// Read the analog value of the photoresistor (0-4095 for ESP32)
int sensorValue = analogRead(photoresistorPin);
// Afficher la valeur lue sur le moniteur série
Serial.print("Photoresistor value: ");
if (sensorValue < 3000){
Serial.println("It's daytime");
}
else {
Serial.println("It's night");
}
//Serial.println(sensorValue);
// Wait a little before the next reading
delay(1000); // 1 second
}