Microbit Accelerometer


The Microbit Accelerometer Service is a Bluetooth LE Service specific to the Microbit. API Reference

How To Connect

The Microbit is a Bluetooth LE device, so you use the Gobot ble.ClientAdaptor to connect. You need to know the BLE address or name of the device.

  bleAdaptor := ble.NewClientAdaptor("c5:b9:46:fd:40:c0")
  ubit := microbit.NewAccelerometerDriver(bleAdaptor)

How To Use

Once you have connected using the ble.ClientAdaptor, you can call any of the Driver's methods, or subscribe to any of the driver's events.
  ubit.On(microbit.Accelerometer, func(data interface{}) {
     fmt.Println("Accelerometer", data)
  })

Compatibility