#define LDR_PIN 34
#define LED_PIN 18
const int pwmChannel = 0;
const int freq = 5000;
const int resolution = 8;
void setup() {
Serial.begin(115200);
ledcAttach(LED_PIN, freq, resolution);
}
void loop() {
int ldrValue = analogRead(LDR_PIN);
int brightness = map(ldrValue, 0, 4095, 255, 0);
ledcWrite(LED_PIN, brightness);
Serial.print("LDR Value: ");
Serial.print(ldrValue);
Serial.print(" Brightness: ");
Serial.println(brightness);
delay(1000);
}