-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrasrobo2.html
80 lines (79 loc) · 2.78 KB
/
rasrobo2.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<body>
<p>ボタンを押すとRasRoboが動くよ!</p>
<button type="button" onClick="right_forward()">右前</button>
<button type="button" onClick="forward()">前進</button>
<button type="button" onClick="left_forward()">左前</button>
<button type="button" onClick="stop()">停止</button>
<button type="button" onClick="right_back() ">右後</button>
<button type="button" onClick="back()">後進</button>
<button type="button" onClick="left_back() ">左後</button>
<script type="text/javascript" src="/webiopi.js"></script>
<script type="text/javascript">
var webiopi = webiopi();
webiopi.ready(function() {
webiopi.refreshGPIO(true);
webiopi.setFunction(8, "OUT");
webiopi.setFunction(7, "OUT");
webiopi.setFunction(23, "OUT");
webiopi.setFunction(24, "OUT");
});
function forward() {
webiopi.digitalWrite(8, 1);
webiopi.digitalWrite(7, 0);
webiopi.digitalWrite(23, 1);
webiopi.digitalWrite(24, 0);
}
function back() {
webiopi.digitalWrite(8, 0);
webiopi.digitalWrite(7, 1);
webiopi.digitalWrite(23, 0);
webiopi.digitalWrite(24, 1);
}
function stop() {
webiopi.digitalWrite(8, 0);
webiopi.digitalWrite(7, 0);
webiopi.digitalWrite(23, 0);
webiopi.digitalWrite(24, 0);
}
function right_forward() {
webiopi.digitalWrite(8, 1);
webiopi.digitalWrite(7, 0);
webiopi.digitalWrite(23, 0);
webiopi.digitalWrite(24, 0);
}
function left_forward() {
webiopi.digitalWrite(8, 0);
webiopi.digitalWrite(7, 0);
webiopi.digitalWrite(23, 1);
webiopi.digitalWrite(24, 0);
}
function right_back() {
webiopi.digitalWrite(8, 0);
webiopi.digitalWrite(7, 1);
webiopi.digitalWrite(23, 0);
webiopi.digitalWrite(24, 0);
}
function left_back() {
webiopi.digitalWrite(8, 0);
webiopi.digitalWrite(7, 0);
webiopi.digitalWrite(23, 0);
webiopi.digitalWrite(24, 1);
}
</script>
<style type="text/css">
button {
display: inline;
margin: 5px 5px 5px 5px;
width: 80px;
height: 45px;
border-radius: 10px;
font-size: 12pt;
font-weight: bold;
color: white;
background-color:#808080
}
body {
background-color:#C0C0C0
}
</style>
</body>