I want to write a ESP32 code about automatically controlling the brightness of the Neopixel light bar

Please edit your post and put the code in code tags.