-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtester.js
42 lines (32 loc) · 868 Bytes
/
tester.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const boost = require('movehub-async');
(async () => {
const hub = await boost.getHubAsync();
hub.on('error', err => {
console.log('error', err);
});
hub.on('disconnect', () => {
console.log('disconnect');
});
hub.on('distance', distance => {
console.log('distance', distance);
});
hub.on('rssi', rssi => {
console.log('rssi', rssi);
});
hub.on('port', portObject => {
console.log('port', JSON.stringify(portObject, null, 1));
});
hub.on('color', color => {
console.log('color', color);
});
hub.on('tilt', tilt => {
console.log('tilt', JSON.stringify(tilt, null, 1));
});
hub.on('rotation', rotation => {
console.log('rotation', JSON.stringify(rotation, null, 1));
});
// Insert commands here
await hub.ledAsync('red');
await hub.ledAsync('yellow');
await hub.ledAsync('green');
})();