Home

Awesome

bluetooth-beacons

This PXT package allows the micro:bit to act as iBeacon / AltBeacon advertiser.

Usage

On MakeCode workspace, open the menu item Add Package..., and specify the package id github:kshoji/pxt-bluetooth-beacons.

iBeacon

To advertise BLE iBeacon packets, write code like this.

bluetooth.advertiseIBeacon("E20A39F4-73F5-4BC4-A12F-17D1AD07A961", 1, 2, -56);

Arguments: uuid, majorId, minorId, and txPower.

AltBeacon

To advertise BLE AltBeacon packets, write code like this.

let beaconId = pins.createBuffer(20)
beaconId.setNumber(NumberFormat.Int32BE, 0, 0x01020304)
beaconId.setNumber(NumberFormat.Int32BE, 4, 0x05060708)
beaconId.setNumber(NumberFormat.Int32BE, 8, 0x090A0B0C)
beaconId.setNumber(NumberFormat.Int32BE, 12, 0x0D0E0F10)
beaconId.setNumber(NumberFormat.Int32BE, 16, 0x11121314)

bluetooth.advertiseAltBeacon(0x0059, beaconId, -56)

Arguments: manufacturerId, beaconId, and txPower.

Supported targets

(The metadata above is needed for package search.)

License

Source code: MIT

icon.png: Culmstock: Culmstock Beacon cc-by-sa/2.0 - © Martin Bodman - geograph.org.uk/p/213525

bluetooth
bluetooth-beacons=github:kshoji/pxt-bluetooth-beacons