forked from simonmonk/raspirobotboard3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome.tpl
More file actions
61 lines (51 loc) · 1.17 KB
/
Copy pathhome.tpl
File metadata and controls
61 lines (51 loc) · 1.17 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
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<style>
.controls {
width: 150px;
font-size: 32pt;
text-align: center;
padding: 15px;
background-color: green;
color: white;
}
</style>
<script>
function sendCommand(command)
{
$.get('/', {command: command});
}
function keyPress(event){
code = event.keyCode;
if (code == 119) {
sendCommand('f');
}
else if (code == 97) {
sendCommand('l');
}
else if (code == 115) {
sendCommand('s');
}
else if (code == 100) {
sendCommand('r');
}
else if (code == 122) {
sendCommand('b');
}
}
$(document).keypress(keyPress);
</script>
</head>
<body>
<h1>Web Rover</h1>
<table align="center">
<tr><td></td><td class="controls" onClick="sendCommand('f');">W</td><td></td></tr>
<tr><td class="controls" onClick="sendCommand('l');">A</td>
<td class="controls" onClick="sendCommand('s');">S</td>
<td class="controls" onClick="sendCommand('r');">D</td>
</tr>
<tr><td></td><td class="controls" onClick="sendCommand('b');">Z</td><td></td></tr>
</table>
</body>
</html>