forked from r2jitu/webduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
33 lines (31 loc) · 1019 Bytes
/
index.html
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
<!doctype html>
<html>
<head>
<title>Webduino</title>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect();
function ledToggle(device) {
socket.emit('led toggle', {
device: device
});
}
function robot(data) {
socket.emit('robot', data);
}
</script>
</head>
<body>
<button onclick="ledToggle('light')">Toggle LED - light</button>
<button onclick="ledToggle('robot')">Toggle LED - robot</button>
<hr>
<button style="width: 200px;" onclick="robot({left: 255})">Left forward</button>
<button style="width: 200px;" onclick="robot({right: 255})">Right forward</button>
<br>
<button style="width: 200px;" onclick="robot({left: 0})">Left stop</button>
<button style="width: 200px;" onclick="robot({right: 0})">Right stop</button>
<br>
<button style="width: 200px;" onclick="robot({left: -255})">Left backward</button>
<button style="width: 200px;" onclick="robot({right: -255})">Right backward</button>
</body>
</html>