You are using "analogWrite(x,y); " to turn on the LEDs. Correct?
I don't know the ESP32 nano well, but the ESP32 platform doesn't have
the function "analogWrite(x,y);. The ESP 32 uses its own hardware/software
called LEDC.
See the theory of using LEDC in " esp32_technical_reference_manual "
Chapter 14 page 385
Or use a library for PWM for the ESP32.
PS: I find this information
" Yes, the Arduino Nano has PWM (Pulse Width Modulation) capabilities .