-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinputs.html
More file actions
50 lines (40 loc) · 1.33 KB
/
inputs.html
File metadata and controls
50 lines (40 loc) · 1.33 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
<!DOCTYPE html>
<html>
<head>
<title>Moon Buggies</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<header>
<a href="https://scienceoxford.com" target="_blank"><img src=".\images\so_logo.png" alt="Science Oxford Logo" width="400px" height="auto"></a>
<h1>Using inputs</h1>
</header>
<div id="" class="left">
<h3>Code Example</h3>
<pre>from microbit import *
import radio
radio.on()
radio.config(channel=0)
display.show(Image.DUCK)
# begin a forever loop
while True:
if button_a.was_pressed():
radio.send('forward 500 1000')
if button_b.was_pressed():
radio.send('grab 3')
if accelerometer.was_gesture('shake'):
radio.send('left 500 5000')</pre>
<br>
<p>Look at the <em>syntax</em> and think about where you should add it into your own program - remember that the micro:bit will do your instructions in the order you write them.</p>
<br>
</div>
<nav class="links bg_green">
<a href="index.html">Go Back</a>
</nav>
<footer class="links">
<a href="https://github.com/ScienceOxford/moon-buggies" target="_blank">View on GitHub</a>
</footer>
</body>
</html>