-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeb.html
50 lines (44 loc) · 1.33 KB
/
Web.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
<!DOCTYPE html>
<html style="text-align: center; background-color: #000000; border-style: solid; border-width: 5px; border-color: #FFFFFF;">
<head>
<title>Bike Matrix Display</title>
<meta name="viewport" content="width=device-width, minimumscale=1.0, maximum-scale=1.0, initial-scale=1" />
</head>
<body>
<h1 style="color: #009933;">Matrix Display</h1>
<textarea rows="10" cols="40" id="message"></textarea>
<br>
<br>
<input id="speedSlider" oninput="sliderUpdate();" type="range" min="1" max="100" value="50">
<br>
<button type="button" onclick="sendSocketData();">SEND</button>
<br>
<br>
</body>
<script>
var Socket;
var i = 0;
Socket = new WebSocket('ws://' + window.location.hostname + ':81/');
function sendSocketData(){
var mess = document.getElementById('message').value;
if(checkNull(mess)==false){
alert("Please enter your message.");
}
else{
Socket.send("~"+mess.trim());
}
}
function checkNull(dump){
if(dump == null || dump.trim() == ''){
return false;
}
else{
return true;
}
}
function sliderUpdate() {
var x = document.getElementById("speedSlider").value;
Socket.send("`"+x);
}
</script>
</html>