USB Data Connection Detection with WatchX

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();

Here is the library thread in the forum

Here is the library Github link

1 Like