+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions iot/YYYY-MM-DD-MICRO-BIT-EDDYSTONE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Mon micro:bit est un beacon :pig:

> WIP
56 changes: 56 additions & 0 deletions iot/src/eddystone.first.js
Original file line number Diff line number Diff line change
@@ -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});
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载