//DECLARATION
int ledPin = 5;
int photoresistorPin = A0;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
pinMode(photoresistorPin, INPUT);
Serial.begin(9600);
}
void loop() {
int lightValue = analogRead(photoresistorPin);
int brightness = map(lightValue, 0, 1023, 0, 255);
// Set the LED brightness
analogWrite(ledPin, brightness);
Serial.println(lightValue);
Serial.println(brightness);
delay(1000);
}