SerialUSB question

Post here first, or if you can't find a relevant section!
Post Reply
asmallri
Posts: 20
Joined: Fri Oct 06, 2017 12:37 am

SerialUSB question

Post by asmallri » Mon Jan 15, 2018 4:57 pm

Hi,

How can I determine if a Bluepill is attached via USB versus connected? I want to find out if a Bluepill is plugged into a device as opposed to having an open serial connection to the device.

Is the statement

Code: Select all

if(!Serial())
the equivalent of

Code: Select all

 Serial.isattached()
Thanks, Andrew

stevestrong
Posts: 2048
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: SerialUSB question

Post by stevestrong » Mon Jan 15, 2018 6:30 pm

You could use the function

Code: Select all

if ( usb_is_connected(USBLIB) )
{
}

Post Reply