const int ANALOG_PIN = 26; // Define the pin number for the analog input (ADC0 on GPIO26)
const int LED_PIN = 15; // Define the pin number for the LED
void setup() {
pinMode(ANALOG_PIN, INPUT); // Set the analog pin as input
pinMode(LED_PIN, OUTPUT); // Set the LED pin as output
}
void loop() {
int sensorValue = analogRead(ANALOG_PIN); // Read the analog input
int brightness = map(sensorValue, 0, 4095, 0, 255); // Map the sensor value to LED brightness range
analogWrite(LED_PIN, brightness); // Set the LED brightness based on the analog input
Serial.print("Analog reading: ");
Serial.println(sensorValue); // Print the analog reading to the Serial Monitor
delay(500); // Delay for readability
}