forked from mainehackerclub/JohnnySocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (39 loc) · 1.28 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<script src="/socket.io/socket.io.js"></script>
<script>
// Socket.io Initialization
var socket = io.connect();
function ledOn(pin,strobe) {
socket.emit('ledOn',{pin:pin,action:"strobe",period:strobe});
console.log('ledOn');
};
function ledOff(pin) {
socket.emit('ledOff',{pin:pin,action:"off"});
console.log('ledOff');
};
function servo(pin,pos) {
socket.emit('servo',{component:"servo",pin:pin,pos:pos});
console.log('servo '+pin+' '+pos);
};
socket.on('board',function(data) {
console.log(data);
});
</script>
<body>
<button onclick="ledOn(3,100)">LED 3 100</button>
<button onclick="ledOff(3)">LED 3 OFF</button>
<br>
<button onclick="ledOn(4,100)">LED 4 100</button>
<button onclick="ledOff(4)">LED 4 OFF</button>
<br>
<button onclick="ledOn(5,100)">LED 5 100</button>
<button onclick="ledOff(5)">LED 5 OFF</button>
<br>
<button onclick="servo(13,'min')">Servo 13 Min</button>
<button onclick="servo(13, 45)">Servo 13 45</button>
<button onclick="servo(13, 90)">Servo 13 90</button>
<button onclick="servo(13, 135)">Servo 13 135</button>
<button onclick="servo(13,'max')">Servo 13 Max</button>
<button onclick="servo(13,'sweep')">Servo 13 Sweep</button>
</body>
</html>