Changing the ambient brightness changes the brightness of the LED
Using ESP32 with Arduino Framework the FreeRTOS Queue pass struct Sensor{};
data between the tasks. Choose the amount of samples samplesAmount
and read the ADC data from the voltage divider with a photoresistor. Make calculations and control the LED with PWM. Calculate the desired resistors ratio values for the voltage divider with VoltageDividerCalc.ods.