const int photoresistorPin = A0;
const int ledPin = 13;
const int threshold = 400;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int lightLevel = analogRead(photoresistorPin);
Serial.println(lightLevel);
if (lightLevel > threshold) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(100);
}