+
Skip to content

🇫🇷 micro:bit == 🐷 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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浏览器服务,不要输入任何密码和下载