Can a microbit detect a host computer

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Can a microbit detect a host computer

Post by rhubarbdog » Sat Mar 23, 2019 1:09 pm

Is there a way to detetmine if a microbit is connected to a laptop via usb. Is there a micropython function the microbit can run to detect a usb host

shaoziyang
Posts: 261
Joined: Sun Apr 17, 2016 1:55 pm

Re: Can a microbit detect a host computer

Post by shaoziyang » Sun Mar 24, 2019 9:43 am

I don't think so.

rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Re: Can a microbit detect a host computer

Post by rhubarbdog » Mon Apr 01, 2019 8:20 am

I was looking at some pyboard docs. There is a function in the pyb version of micropython. I'm going to raise a feature request

User avatar
jimmo
Posts: 415
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: Can a microbit detect a host computer

Post by jimmo » Sat Apr 27, 2019 11:31 am

I'm not aware that this would be possible to detect that USB is connected -- the USB functionality is handled by a separate chip on the micro:bit (which runs Daplink). The only pins connected between the NRF51822 (that runs your MicroPython code) is the TX/RX pair for the UART. [Ref: https://github.com/bbcmicrobit/hardware ... _V1.3B.pdf]

On the other hand, if you had something running on the host computer that detected the micro:bit then send it a message over the UART, that might work.

(Note that on the microbit, the single UART is also used by the REPL).

Post Reply