-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
60 lines (46 loc) · 1.49 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html>
<head>
<meta charset="UTF-8">
<!-- to get rid of favicon request in console -->
<link rel="shortcut icon" href="">
<!-- set viewport - for responsive -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- P5 -->
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.8/p5.js"></script>
<script src="libraries/p5.dom.js" type="text/javascript"></script>
<script src="libraries/p5.play.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="sketch.js"></script>
<!-- SOCKET.IO -->
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script>
//socket stuff
var socket = io.connect();
socket.on('connect', function() {
console.log("Connected");
});
socket.on('sensor', function(data){
// console.log(data);
//split it
var values = split(data, ",");
// Player 1
sensorX1 = Number(values[0]); // Horizontal - Left and Right (0-1023)
sensorY1 = Number(values[1]); // Verticle - Up and Down (0-1023)
sensorR1 = Number(values[2]); // Rotation (0-1023) -> Mapped (0-360)
sensorS1 = Number(values[3]); // Select - Joystick Down (0-1)
// Player 2
sensorX2 = Number(values[4]);
sensorY2 = Number(values[5]);
sensorR2 = Number(values[6]);
sensorS2 = Number(values[7]);
});
</script>
<style>
body{
padding: 0;
margin: 0;
}
</style>
</head>
<body>
</body>
</html>