detect if USB is plugged in ?

MKRZero:
is it possible to detect from the processor (within my sketch),
if the USB is plugged in/or not ?
(regardless of serial communication / only detecting the presence of 5V VUSB ?)

(need it for MSD bootloader)

Hi, yes it is possible but isn't a built in-function.

What you can do is test if there are or not the 5V. This voltage is there only if the USB is plugged. So if you scale down this voltage (voltage divider) to 3.3V using digitalRead() if you have HIGH USB is plugged, otherwise not!

Hope this help :wink: