-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
40 lines (39 loc) · 1.01 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
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#cmd').on('keydown', function (e) {
e.preventDefault();
var cmd = String.fromCharCode(e.which);
$.ajax({
type: 'POST',
url: '/setNextCmd?id='+$('#id').val()+'&cmd='+cmd,
success: function (data) {
$('#response').text(data);
}
});
});
// Prepopulate ID so I can give out links like
// blah.com/#myrobot to drive a particular robot.
var hash = window.location.hash;
if (hash)
$('#id').val(hash.substring(1));
});
</script>
</head>
<body>
<div>
<label for="id">Arduino client ID</label>
<input id="id" type="text"/>
</div>
<div>
<label for="cmd">Command (W/A/S/D)</label>
<input id="cmd" type="text"/>
</div>
<div>
<span id="response"></span>
</div>
</body>
</html>