Skip to content

Commit 34aa218

Browse files
authored
2025 update
1 parent ac32ee4 commit 34aa218

File tree

24 files changed

+73
-0
lines changed

24 files changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
gesture = accelerometer.current_gesture()
6+
if gesture == "right":
7+
display.show(Image.ARROW_E)
8+
elif gesture == "left":
9+
display.show(Image.ARROW_W)
10+
else:
11+
display.show(Image.SKULL)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
import random
4+
5+
answers = [
6+
"Yes",
7+
"No",
8+
"I cannot answer that yet"
9+
]
10+
11+
while True:
12+
display.show("?")
13+
if accelerometer.was_gesture("shake"):
14+
display.clear()
15+
sleep(1000)
16+
display.scroll(random.choice(answers))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
readingx = accelerometer.get_x()
6+
readingy = accelerometer.get_y()
7+
8+
if readingx > 20:
9+
display.show("R")
10+
elif readingx < -20:
11+
display.show("L")
12+
13+
elif readingy > 20:
14+
display.show("U")
15+
elif readingy < -20:
16+
display.show("D")
17+
18+
else:
19+
display.show("-")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
import speech
5+
6+
speech.say("How are you?", speed=110, pitch=200, throat=100, mouth=255)
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
import random
5+
while True:
6+
if button_a.is_pressed():
7+
display.show(str(random.randint(1, 6)))
8+
sleep(2000)
9+
else:
10+
display.show(Image.TSHIRT)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
import random
5+
while True:
6+
if button_a.is_pressed():
7+
display.show(str(random.randint(1, 26)))
8+
sleep(2000)
9+
else:
10+
display.show(Image.TSHIRT)

0 commit comments

Comments
 (0)