summaryrefslogtreecommitdiffstats
path: root/examples/magpi-9-cambot2/index.html
blob: db69b417b19af4ca0d207562e376b9dffbc30b73 (plain)
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
62
63
64
65
66
67
68
69
70
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content = "height = device-height, width = 420, user-scalable = no" /> 
	<title>CamBot</title>
	<script type="text/javascript" src="/webiopi.js"></script>
	<script type="text/javascript">
	function init() {
		var button;
			
		button = webiopi().createButton("bt_up", "/\\", go_forward, stop);
		$("#up").append(button);
		
		button = webiopi().createButton("bt_left", "<", turn_left, stop);
		$("#middle").append(button);
		
		button = webiopi().createButton("bt_stop", "X", stop);
		$("#middle").append(button);
		
		button = webiopi().createButton("bt_right", ">", turn_right, stop);
		$("#middle").append(button);
		
		button = webiopi().createButton("bt_down", "\\/", go_backward, stop);
		$("#down").append(button);
	}
	
	function go_forward() {
		webiopi().callMacro("go_forward");
	}
		
	function go_backward() {
		webiopi().callMacro("go_backward");
	}
		
	function turn_right() {
		webiopi().callMacro("turn_right");
	}
		
	function turn_left() {
		webiopi().callMacro("turn_left");
	}
		
	function stop() {
		webiopi().callMacro("stop");
	}
	
	webiopi().ready(init);
		
	</script>
	<style type="text/css">
		button {
			margin: 5px 5px 5px 5px;
			width: 50px;
			height: 50px;
			font-size: 24pt;
			font-weight: bold;
			color: black;
		}
	</style>
</head>
<body>
	<div id="content" align="center">
		<img width="320" height="240" src="http://raspberrypi:8001/?action=stream"><br/>
		<div id="up"></div>
		<div id="middle"></div>
		<div id="down"></div>
	</div>
</body>
</html>