Global

Methods

uBitConnectDevice(callback)

Allow users to select a device to connect to.
Parameters:
Name Type Description
callback uBitEventCallback function for device events
Source:

uBitDisconnect(device)

Disconnect from a device
Parameters:
Name Type Description
device USBDevice to disconnect from
Source:

uBitSend(device, data)

Send a string to a specific device
Parameters:
Name Type Description
device USBDevice
data string to send (must not include newlines)
Source:

Type Definitions

uBitEventCallback(event, device, data)

Callback for micro:bit events Event data varies based on the event string:
  • "connection failure": null
  • "connected": null
  • "disconnected": null
  • "error": error object
  • "console": { "time":Date object "data":string}
  • "graph-data": { "time":Date object "graph":string "series":string "data":number}
  • "graph-event": { "time":Date object "graph":string "series":string "data":string}
Parameters:
Name Type Description
event string ("connection failure", "connected", "disconnected", "error", "console", "graph-data", "graph-event" )
device USBDevice triggering the callback
data * (event-specific data object). See list above for variants
Source: