-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbasic.html
More file actions
73 lines (58 loc) · 1.57 KB
/
basic.html
File metadata and controls
73 lines (58 loc) · 1.57 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<html>
<head>
<script src="../dist/webduino-all.js"></script>
<script>
var board, led;
board = new webduino.WebArduino('device_id');
// board = new webduino.WebArduino({
// 'transport': 'serial',
// 'baudRate': 57600,
// 'path': '/dev/cu.usbmodem1411'
// });
// board = new webduino.Arduino({
// 'transport': 'serial',
// 'path': '/dev/cu.usbmodem1421'
// });
// board = new webduino.Arduino({
// 'transport': 'bluetooth',
// 'address': '30:14:09:30:15:67'
// });
// board = new webduino.Arduino({
// 'transport': 'mqtt',
// 'device': '',
// 'server': 'wss://ws.webduino.io:443/',
// 'login': 'admin',
// 'password': 'password'
// });
// board = new webduino.Arduino({
// 'transport': 'websocket',
// 'url': 'wa1501.local'
// });
board.on(webduino.BoardEvent.READY, function() {
console.log('board ready');
led = new webduino.module.Led(board, board.getDigitalPin(13));
led.blink(500);
setTimeout(function() {
board.close();
}, 5000);
});
board.on(webduino.BoardEvent.ERROR, function(err) {
console.log('board error', err.message);
});
board.on(webduino.BoardEvent.BEFOREDISCONNECT, function() {
console.log('board beforedisconnect');
});
board.on(webduino.BoardEvent.DISCONNECT, function() {
console.log('board disconnect');
// test: should not emit 'disconnect' again
board.disconnect();
});
board.on(webduino.BoardEvent.RECONNECT, function () {
console.log("board reconnect");
});
</script>
</head>
<body>
test
</body>
</html>