Skip to content

crwdns342183:0crwdne342183:0

crwdns337129:0crwdne337129:0

crwdns347531:0crwdne347531:0 | MakeCode, Python | crwdns255566:0crwdne255566:0, crwdns255570:0crwdne255570:0, crwdns255572:0crwdne255572:0, crwdns255578:0crwdne255578:0 | crwdns258502:0crwdne258502:0, crwdns258504:0crwdne258504:0, crwdns258528:0crwdne258528:0, crwdns258584:0crwdne258584:0, crwdns258616:0crwdne258616:0

crwdns337033:0crwdne337033:0

crwdns337035:0crwdne337035:0

crwdns337037:0crwdne337037:0

crwdns337039:0crwdne337039:0

crwdns337041:0crwdne337041:0

crwdns337043:0crwdne337043:0

crwdns337045:0crwdne337045:0

crwdns337047:0crwdne337047:0

crwdns337049:0crwdne337049:0 crwdns337051:0crwdne337051:0 crwdns337053:0crwdne337053:0 crwdns337055:0crwdne337055:0

crwdns337057:0crwdne337057:0

  • crwdns337059:0crwdne337059:0 crwdns337061:0crwdne337061:0
  • crwdns337063:0crwdne337063:0 crwdns337065:0crwdne337065:0
  • crwdns337067:0crwdne337067:0 crwdns337069:0crwdne337069:0
  • crwdns337071:0crwdne337071:0 crwdns337073:0crwdne337073:0
  • crwdns337075:0crwdne337075:0 crwdns337077:0crwdne337077:0 crwdns337079:0crwdne337079:0
  • crwdns337081:0crwdne337081:0 crwdns337083:0crwdne337083:0
  • crwdns337085:0crwdne337085:0 crwdns337087:0crwdne337087:0 crwdns337089:0crwdne337089:0 crwdns359380:0crwdne359380:0 crwdns359382:0crwdne359382:0
  • crwdns337095:0crwdne337095:0 crwdns337097:0crwdne337097:0
  • crwdns337099:0crwdne337099:0

crwdns337101:0crwdne337101:0

  • crwdns337103:0crwdne337103:0
  • crwdns337105:0crwdne337105:0
  • crwdns337107:0crwdne337107:0
  • crwdns358572:0crwdne358572:0

crwdns358574:0crwdne358574:0

crwdns358576:0crwdne358576:0

crwdns347365:0crwdne347365:0

crwdns337111:0crwdne337111:0

1# Imports go at the top
2from microbit import *
3import music
4
5
6display.show(Image.HAPPY)
7
8while True:
9    sleep(300)
10    if button_a.is_pressed() and button_b.is_pressed():
11        if display.read_light_level() < 50:
12            music.play(music.POWER_DOWN, wait=False)
13            display.show(Image('00990:'
14                               '00099:'
15                               '00099:'
16                               '00099:'
17                               '00990'))
18        else:
19            music.play(music.POWER_UP, wait=False)
20            display.show(Image('90909:'
21                               '09990:'
22                               '99999:'
23                               '09990:'
24                               '90909'))
25    elif button_b.is_pressed():
26        music.play(music.BA_DING, wait=False)
27        display.clear()
28        sleep(100)
29        display.scroll('Hello!')
30    elif button_a.is_pressed():
31        music.play(music.PRELUDE, wait=False)
32        for i in range(2):
33            display.show(Image('00000:'
34                               '00000:'
35                               '00900:'
36                               '00000:'
37                               '00000'))
38            sleep(100)
39            display.show(Image('00000:'
40                               '09990:'
41                               '09990:'
42                               '09990:'
43                               '00000'))
44            sleep(100)
45            display.show(Image('99999:'
46                               '99999:'
47                               '99999:'
48                               '99999:'
49                               '99999'))
50            sleep(1000)
51            display.show(Image('00000:'
52                               '09990:'
53                               '09990:'
54                               '09990:'
55                               '00000'))
56            sleep(1000)
57            display.show(Image('00000:'
58                               '00000:'
59                               '00900:'
60                               '00000:'
61                               '00000'))
62            sleep(1000)
63    elif accelerometer.is_gesture('shake'):
64        music.play(music.JUMP_UP, wait=False)
65        display.show(Image.SURPRISED)
66    
67

crwdns337113:0crwdne337113:0

  • crwdns337115:0crwdne337115:0
  • crwdns337117:0crwdne337117:0 crwdns337119:0crwdne337119:0 crwdns337121:0crwdne337121:0