Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4919

MicroPython • Re: Detecting PI Pico if powered via USB or GPIO pins

$
0
0
You can check the VBUS by testing the value of 'WL_GPIO2' pin, if it's high, the VBUS is present, e.g:

Code:

from machine import Pinvbus = Pin('WL_GPIO2', Pin.IN)if vbus():    print('USB connected')else:    print('USB not connected')

Statistics: Posted by horuable — Mon Jul 15, 2024 5:46 am



Viewing all articles
Browse latest Browse all 4919

Trending Articles