Skip to content

Instantly share code, notes, and snippets.

@EvanSimpson
Created August 7, 2014 23:34
Show Gist options
  • Save EvanSimpson/38f03e0b201ef0115e23 to your computer and use it in GitHub Desktop.
Save EvanSimpson/38f03e0b201ef0115e23 to your computer and use it in GitHub Desktop.
Turn your Tessel BLE module into an iBeacon
var tessel = require('tessel');
var bleLib = require('ble-ble113a');
var bleadvertise = require('bleadvertise');
var uuid = 'D9B9EC1F392543D080A91E39D4CEA95C'; // Apple's example UUID
var major = '01';
var minor = '10';
var iBeaconData = new Buffer(uuid+major+minor, 'hex'); // Create data Buffer
var packet = {
flags: [0x04], // BLE only
mfrData : iBeaconData
}
var ad = bleadvertise.serialize(packet);
var beacon = bleLib.use(tessel.port['A'], function(){
beacon.setAdvertisingData(ad, function(){
beacon.startAdvertising();
console.log('Beaconing');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment