Skip to content

Commit 63da263

Browse files
authored
Merge pull request #1 from GarethEdgell/GarethEdgell-patch-1
Add files via upload
2 parents 9c105ad + 76d415c commit 63da263

File tree

89 files changed

+2488
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2488
-0
lines changed

Diff for: Healthy Eating (1 to 6)/Micropython for microbit_L1_updated/Baseline test answers.rtf

+990
Large diffs are not rendered by default.

Diff for: Healthy Eating (1 to 6)/Micropython for microbit_L1_updated/Baseline test.rtf

+968
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.
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+
5+
while True:
6+
display.scroll('Hello, World!')
7+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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+
boat = Image("05050:"
5+
"05050:"
6+
"05050:"
7+
"99999:"
8+
"09990")
9+
10+
display.show(boat)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
from time import sleep
4+
5+
dot1 = Image("00000:"
6+
"00000:"
7+
"00000:"
8+
"00000:"
9+
"50000")
10+
11+
dot2 = Image("00000:"
12+
"00000:"
13+
"00000:"
14+
"00000:"
15+
"05000")
16+
17+
dot3 = Image("00000:"
18+
"00000:"
19+
"00000:"
20+
"00000:"
21+
"00500")
22+
23+
display.show(dot1)
24+
sleep(0.5)
25+
display.show(dot2)
26+
sleep(0.5)
27+
display.show(dot3)
28+
sleep(0.5)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Add your Python code here. E.g.
2+
3+
from microbit import *
4+
5+
while True:
6+
if button_a.is_pressed():
7+
display.show(Image.HAPPY)
8+
else:
9+
display.show(Image.SAD)
10+
11+
display.clear()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if button_a.is_pressed():
6+
display.show(Image.HAPPY)
7+
elif button_b.is_pressed():
8+
display.show(Image.SAD)
9+
else:
10+
display.show(Image.ASLEEP)
11+
12+
display.clear()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if button_a.is_pressed():
6+
display.scroll("Yes")
7+
elif button_b.is_pressed():
8+
display.show(Image.SAD)
9+
else:
10+
display.show(Image.ASLEEP)
11+
12+
display.clear()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if button_a.is_pressed() and button_b.is_pressed():
6+
display.scroll("Yes")
7+
elif button_b.is_pressed():
8+
display.show(Image.SAD)
9+
elif button_a.is_pressed():
10+
display.show(Image.GHOST)
11+
else:
12+
display.show(Image.ASLEEP)
13+
14+
display.clear()
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+
4+
shopping_list = ("cheese", "beans", "apples")
5+
x = 0
6+
7+
while True:
8+
if button_a.is_pressed():
9+
display.scroll(str(shopping_list[x]))
10+
if button_b.is_pressed():
11+
x = x + 1
12+
sleep(1000)
13+
else:
14+
display.clear()
15+
16+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if pin0.is_touched():
6+
display.show(Image.SQUARE_SMALL)
7+
else:
8+
display.show(Image.SQUARE)
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+
if pin0.is_touched():
6+
display.show(Image.SQUARE_SMALL)
7+
sleep(500)
8+
display.show(Image.SQUARE)
9+
sleep(500)
10+
else:
11+
display.show(Image.CHESSBOARD)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if pin0.is_touched():
6+
display.show(Image.SQUARE_SMALL)
7+
sleep(500)
8+
display.show(Image.SQUARE)
9+
sleep(500)
10+
elif pin1.is_touched():
11+
display.scroll("SAFE")
12+
else:
13+
display.show(Image.CHESSBOARD)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
total = 0
5+
6+
while True:
7+
if button_a.is_pressed():
8+
total = total + 1
9+
sleep(100)
10+
display.scroll(total)
11+
elif button_b.is_pressed():
12+
total = total - 2
13+
sleep(100)
14+
display.show(total)
15+
elif button_a.is_pressed() and button_b.is_pressed():
16+
total = 0
17+
sleep(100)
18+
display.show(total)
19+
else:
20+
display.show(Image.SMILE)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
display.scroll("The Food Quiz")
5+
display.scroll("Get Ready")
6+
sleep(2000)
7+
8+
#1
9+
display.scroll("Q1")
10+
display.scroll("Yes = A: No = B")
11+
display.scroll("Do you eat chocolate every day?")
12+
13+
while True:
14+
if button_a.is_pressed():
15+
display.scroll("Too much")
16+
display.show(Image.SAD)
17+
sleep(2000)
18+
break
19+
20+
elif button_b.is_pressed():
21+
display.scroll("Good")
22+
display.show(Image.SMILE)
23+
sleep(2000)
24+
break
25+
26+
#2
27+
display.scroll("Q2")
28+
display.scroll("Yes = A: No = B")
29+
display.scroll("Do you sleep well?")
30+
31+
while True:
32+
if button_a.is_pressed():
33+
display.scroll("That is important")
34+
display.show(Image.SMILE)
35+
sleep(2000)
36+
break
37+
38+
elif button_b.is_pressed():
39+
display.scroll("Get some")
40+
display.show(Image.SAD)
41+
sleep(2000)
42+
break
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
import os
4+
5+
while True:
6+
with open('hello.txt', 'w') as newFile:
7+
if button_a.is_pressed():
8+
newFile.write("Arch")
9+
elif button_b.is_pressed():
10+
newFile.write("Linux")
11+
else:
12+
pass
13+
14+
with open('hello.txt') as file:
15+
output=file.readline()
16+
17+
display.scroll(output)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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+
temp = temperature()
6+
if temp > 26:
7+
display.scroll("Hot")
8+
elif temp > 6 < 15:
9+
display.scroll("Just right")
10+
else:
11+
display.scroll("Too cold")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if accelerometer.was_gesture('shake'):
6+
display.scroll(temperature())
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
light = display.read_light_level()
5+
display.scroll(light)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
from time import sleep
4+
5+
while True:
6+
light = display.read_light_level()
7+
display.scroll(light)
8+
sleep(5)
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+
from time import sleep
4+
5+
while True:
6+
light = display.read_light_level()
7+
if light > 20:
8+
display.show(Image.HAPPY)
9+
else:
10+
display.show(Image.SAD)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Add your Python code here. E.g.
2+
from microbit import *
3+
4+
while True:
5+
if button_a.is_pressed():
6+
pin0.write_digital(1)
7+
else:
8+
pin0.write_digital(0)
9+
10+
11+
12+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Add your Python code here. E.g.
2+
# radio 2
3+
from microbit import *
4+
import radio
5+
radio.on()
6+
7+
# any channel from 0 to 100 can be used for privacy.
8+
radio.config(channel=5)
9+
10+
while True:
11+
msg = radio.receive()
12+
if msg != None:
13+
if msg == 'HAPPY':
14+
display.show(Image.HAPPY)
15+
sleep(200)
16+
display.clear()
17+
elif msg == 'SAD':
18+
display.show(Image.SAD)
19+
sleep(200)
20+
display.clear()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Add your Python code here. E.g.
2+
#radio 1
3+
from microbit import *
4+
5+
import radio
6+
radio.on()
7+
8+
# any channel from 0 to 100 can be used for privacy.
9+
radio.config(channel=5)
10+
11+
while True:
12+
if button_a.was_pressed():
13+
radio.send('HAPPY')
14+
sleep(200)
15+
elif button_b.was_pressed():
16+
radio.send('SAD')
17+
sleep(200)
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add your Python code here. E.g.
2+
#radio 1
3+
from microbit import *
4+
import radio
5+
6+
radio.on()
7+
8+
radio.config(channel=5)
9+
10+
while True:
11+
if button_a.was_pressed():
12+
my_message = "A"
13+
radio.send(my_message)
14+
sleep(200)
15+
16+
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add your Python code here. E.g.
2+
#RADIO 2
3+
from microbit import *
4+
import radio
5+
radio.on()
6+
7+
# any channel from 0 to 100 can be used for privacy.
8+
radio.config(channel=5)
9+
10+
while True:
11+
#radio.send(my_message)
12+
incoming = radio.receive()
13+
if incoming is not None:
14+
display.show(incoming)
15+
print(incoming)
16+
sleep(500)
17+
display.clear()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Add your Python code here. E.g.
2+
#radio 1
3+
from microbit import *
4+
import radio
5+
6+
radio.on()
7+
8+
radio.config(channel=5)
9+
10+
while True:
11+
if button_a.was_pressed():
12+
my_message = "Y"
13+
radio.send(my_message)
14+
sleep(200)
15+
elif button_b.was_pressed():
16+
my_message = "N"
17+
radio.send(my_message)
18+
sleep(200)
19+
20+
21+
22+
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)