Irregularly blinking LED diode

Hi

I’ve added a red LED to my esp32 & esp8266 (RB Pi 4, HA). It flashes when the temperature of a temp probe reaches a certain threshold. So far so good.

#LED pulse effects
output:
  - platform: ledc
    pin: GPIO16
    inverted: FALSE
    id: red_led_output
    frequency: "5000Hz"

light:
  - platform: monochromatic
    output: red_led_output
    name: "Red LED_esp32"
    id: red_led_light_esp32
    effects:
      - pulse:
          name: "Pulse"
          transition_length: 0.5s
          update_interval: 1s

However, I’ve now also added an SSD1306 OLED to the mix and suddenly the flashing of the LED has become much more irregular. I thought switching to a pwm pin on the esp32 would rectify it but it didn’t.

The problem persists regardless if I use a 5 V adapter as opposed to keeping it plugged it into the computer while configuring. I’ve tried frequencies from 100 Hz, to the current 5 kHz, as well as no frequency defined. The irregular blinking eventually appear after some time regardless. Unplug the SSD1306 and it works fine.

Any suggestions as to what could be the problem?