From cb80f27fa2feef4949388bc3ca9f29509b7c76a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Charri=C3=A8re?= Date: Sat, 27 Aug 2016 18:14:37 +0200 Subject: [PATCH 1/2] :fr: micro:bit == :pig: --- iot/YYYY-MM-DD-MICRO-BIT-EDDYSTONE.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 iot/YYYY-MM-DD-MICRO-BIT-EDDYSTONE.md diff --git a/iot/YYYY-MM-DD-MICRO-BIT-EDDYSTONE.md b/iot/YYYY-MM-DD-MICRO-BIT-EDDYSTONE.md new file mode 100644 index 0000000..e1ad562 --- /dev/null +++ b/iot/YYYY-MM-DD-MICRO-BIT-EDDYSTONE.md @@ -0,0 +1,3 @@ +# Mon micro:bit est un beacon :pig: + +> WIP From b74d5d5c510686adb7575930c4fe45cc6d944ae8 Mon Sep 17 00:00:00 2001 From: Philippe CHARRIERE Date: Sun, 4 Sep 2016 16:46:48 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=B7=20EddyStone=20Beacon=20and=20d?= =?UTF-8?q?etection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iot/src/eddystone.first.js | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 iot/src/eddystone.first.js diff --git a/iot/src/eddystone.first.js b/iot/src/eddystone.first.js new file mode 100644 index 0000000..385d997 --- /dev/null +++ b/iot/src/eddystone.first.js @@ -0,0 +1,56 @@ +// Micro:bit beacon + +var heartBeat = [ + " 111 ", + "1 1", + "1 1", + "1 1", + " 111 " +].join("\n"); + +var ping = [ + "11111", + "1 1 1", + "11111", + "1 1 1", + "11111" +].join("\n"); + +var eddyStoneData = [ + 0x03, // Length of Service List + 0x03, // Param: Service List + 0xAA, 0xFE, // Eddystone ID + 0x13, // Length of Service Data + 0x16, // Service Data + 0xAA, 0xFE, // Eddystone ID + 0x10, // Frame type: URL + 0xF8, // Power + 0x03, // https:// + 'g', + 'o', + 'o', + '.', + 'g', + 'l', + '/', + 'T', + 'b', + '0', + '1', + 'T', + 'R' +]; + +var state = ""; +setInterval(function() { + state = state === "" ? heartBeat : ""; + show(state); +}, 500); + +// search for other beacons +NRF.setScan(function(d) { + show(ping); +}); + +// broadcast eddystone data +NRF.setAdvertising(eddyStoneData,{interval:1000});