const int photoResistorPin = A0;
const int ledPin = 9;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
int photoResistorValue = analogRead(photoResistorPin);
int brightness = map(photoResistorValue, 0, 1023, 255, 0);
analogWrite(ledPin, brightness);
Serial.print("Photoresistor Value: ");
Serial.print(photoResistorValue);
Serial.print(", Brightness: ");
Serial.println(brightness);
delay(1000);
}