Skip to content

Instantly share code, notes, and snippets.

@xmen4u
Created October 7, 2014 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xmen4u/c3937d237b7655b74ef6 to your computer and use it in GitHub Desktop.
Save xmen4u/c3937d237b7655b74ef6 to your computer and use it in GitHub Desktop.
ble - ibeacon for tessel
var tessel = require('tessel');
var bleLib = require('ble-ble113a');
var bleadvertise = require('bleadvertise');
var uuid = "D8EE2A9F24176669F9508C97F10AAB5B"; // 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['D'], 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