-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdigitalio.html
More file actions
67 lines (49 loc) · 1.38 KB
/
digitalio.html
File metadata and controls
67 lines (49 loc) · 1.38 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
<!doctype html>
<html>
<head>
<title>mySynth</title>
<script src='/scripts/jquery.js'></script>
<script src="/components/polymer/polymer.min.js"></script>
<script src="/components/polymer/pointerevents.js"></script>
<script src="/scripts/things.js"></script>
<script src="/scripts/socket.io.js"></script>
<link rel="import" href="/interactors/things.html">
<style>
body{
background: rgb(240,240,242);
text-align:center;
}
</style>
</head>
<body>
<script>
var socket = io.connect('http://localhost:8080');
</script>
<div id='container'>
<th-led id='led' pin=8></th-led>
<th-button id='button' pin=6></th-button>
<th-pressure id='pressure' pin=3></th-pressure>
</div>
<script>
// Testing the button and LED implementations
// Simple circuit, turn ON and OFF LED with button click
var button = $('#button')[0];
var pressure = $('#pressure')[0];
var led = $('#led')[0];
button.onClick = function(){
if (led.isOn()){
led.turnOff();
} else {
led.turnOn();
}
}
pressure.onPress = function(){
if (led.isOn()){
led.turnOff();
} else {
led.turnOn();
}
}
</script>
</body>
</html>