The Code snippet below detects an USB Data Connection on the USB Port of WatchX
if (UDADDR & _BV(ADDEN)){ usbDataConnected = 1; } else{ usbDataConnected = 0; }
The Code snippet below detects an USB Data Connection on the USB Port of WatchX
if (UDADDR & _BV(ADDEN)){ usbDataConnected = 1; } else{ usbDataConnected = 0; }
In watchX library that I have wrote, one can use get_usbStatus()
function for same purpose. It works same as @venice1200 described.
Here is the example usage of function:
usbDataConnected = get_usbStatus();