-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·39 lines (24 loc) · 780 Bytes
/
index.html
File metadata and controls
executable file
·39 lines (24 loc) · 780 Bytes
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
<!doctype html>
<html>
<head>
<script src='https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js'></script>
<style>
#sample {
background-color: red;
width: 300px;
height: 300px;
}
</style>
</head>
<body>
<h1>Communicating from an Arduino to Node.js</h1>
<div id="sample"></div>
<script>
var socket = io();
socket.on('data', function(data) {
console.log(data);
document.getElementById('sample').style.opacity = data+"%";
});
</script>
</body>
</html>