crwdns257276:0crwdne257276:0
crwdns257278:0crwdne257278:0
crwdns257280:0crwdne257280:0
crwdns257284:0crwdne257284:0
- crwdns257286:0crwdne257286:0
- crwdns257288:0crwdne257288:0
crwdns257290:0crwdne257290:0
- crwdns257292:0crwdne257292:0
- crwdns257294:0crwdne257294:0
- crwdns257296:0crwdne257296:0
- crwdns257298:0crwdne257298:0
crwdns257300:0crwdne257300:0
1from microbit import *
2import random
3
4while True:
5 if accelerometer.was_gesture('shake'):
6 number = random.randint(1, 6)
7 if number == 1:
8 display.show(Image(
9 "00000:"
10 "00000:"
11 "00900:"
12 "00000:"
13 "00000"))
14 elif number == 2:
15 display.show(Image(
16 "00000:"
17 "00000:"
18 "90009:"
19 "00000:"
20 "00000"))
21 elif number == 3:
22 display.show(Image(
23 "00009:"
24 "00000:"
25 "00900:"
26 "00000:"
27 "90000"))
28 elif number == 4:
29 display.show(Image(
30 "90009:"
31 "00000:"
32 "00000:"
33 "00000:"
34 "90009"))
35 elif number == 5:
36 display.show(Image(
37 "90009:"
38 "00000:"
39 "00900:"
40 "00000:"
41 "90009"))
42 else:
43 display.show(Image(
44 "90009:"
45 "00000:"
46 "90009:"
47 "00000:"
48 "90009"))
crwdns257302:0crwdne257302:0
- crwdns257304:0crwdne257304:0
- crwdns257306:0crwdne257306:0
- crwdns257308:0crwdne257308:0 crwdns257310:0crwdne257310:0
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.