Microbit Magnetometer
The Microbit Magnetometer Service is a Bluetooth LE Service specific to the Microbit.
API ReferenceHow 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.NewMagnetometerDriver(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.Magnetometer, func(data interface{}) {
fmt.Println("Magnetometer", data)
})