Skip to content

ESP32-C3 cannot detect if it is connected to USB. #9743

@berkut0

Description

@berkut0

CircuitPython version

Adafruit CircuitPython 9.1.4
Adafruit CircuitPython 9.2.0-beta.1

Code/REPL

# It was written for rp2040-zero and the code works perfectly.
# But this code doesn't work for esp32-c3 based boards.

import board, supervisor
import neopixel

pixels = neopixel.NeoPixel(board.GP16, 1, auto_write=True)

while True:
    if supervisor.runtime.usb_connected:
        pixels[0] = (0,255,0)
    else:
        pixels[0] = (255,0,0)

Behavior

The LED should be green when the chip is connected via USB and red when the chip is connected to the power supply. In the case of rp2040-zero everything works perfectly, but esp32-c3 gives a false value all the time.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions