Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 1_zoo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add your Python code here. E.g.
from microbit import *
import time

while True:
if pin0.is_touched():
display.show(Image.DUCK)
sleep(10)
elif pin1.is_touched():
display.show(Image.COW)
sleep(10)
elif pin2.is_touched():
display.show(Image.BUTTERFLY)
sleep(10)
else:
display.show(Image.SKULL)
sleep(1)
21 changes: 21 additions & 0 deletions 2_microbit_piano.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add your Python code here. E.g.
from microbit import *
import time
import music

while True:
if pin0.is_touched():
tune = ["A2:4"]
music.play(tune)
sleep(4)
elif pin1.is_touched():
tune = ["B2:4"]
music.play(tune)
sleep(4)
elif pin2.is_touched():
tune = ["C2:4"]
music.play(tune)
sleep(4)
else:
display.show(Image.SKULL)
sleep(1)

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Add your Python code here. E.g.
from microbit import *


while True:
display.scroll('Hello, World!')

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Add your Python code here. E.g.
from microbit import *

boat = Image("05050:"
"05050:"
"05050:"
"99999:"
"09990")

display.show(boat)
28 changes: 28 additions & 0 deletions Healthy Eating (1 to 6)/Micropython for microbit_L2_updated/dot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Add your Python code here. E.g.
from microbit import *
from time import sleep

dot1 = Image("00000:"
"00000:"
"00000:"
"00000:"
"50000")

dot2 = Image("00000:"
"00000:"
"00000:"
"00000:"
"05000")

dot3 = Image("00000:"
"00000:"
"00000:"
"00000:"
"00500")

display.show(dot1)
sleep(0.5)
display.show(dot2)
sleep(0.5)
display.show(dot3)
sleep(0.5)
11 changes: 11 additions & 0 deletions Healthy Eating (1 to 6)/Micropython for microbit_L3_updated/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Add your Python code here. E.g.

from microbit import *

while True:
if button_a.is_pressed():
display.show(Image.HAPPY)
else:
display.show(Image.SAD)

display.clear()
12 changes: 12 additions & 0 deletions Healthy Eating (1 to 6)/Micropython for microbit_L3_updated/2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if button_a.is_pressed():
display.show(Image.HAPPY)
elif button_b.is_pressed():
display.show(Image.SAD)
else:
display.show(Image.ASLEEP)

display.clear()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if button_a.is_pressed():
display.scroll("Yes")
elif button_b.is_pressed():
display.show(Image.SAD)
else:
display.show(Image.ASLEEP)

display.clear()
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if button_a.is_pressed() and button_b.is_pressed():
display.scroll("Yes")
elif button_b.is_pressed():
display.show(Image.SAD)
elif button_a.is_pressed():
display.show(Image.GHOST)
else:
display.show(Image.ASLEEP)

display.clear()
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Add your Python code here. E.g.
from microbit import *

shopping_list = ("cheese", "beans", "apples")
x = 0

while True:
if button_a.is_pressed():
display.scroll(str(shopping_list[x]))
if button_b.is_pressed():
x = x + 1
sleep(1000)
else:
display.clear()


Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if pin0.is_touched():
display.show(Image.SQUARE_SMALL)
else:
display.show(Image.SQUARE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if pin0.is_touched():
display.show(Image.SQUARE_SMALL)
sleep(500)
display.show(Image.SQUARE)
sleep(500)
else:
display.show(Image.CHESSBOARD)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if pin0.is_touched():
display.show(Image.SQUARE_SMALL)
sleep(500)
display.show(Image.SQUARE)
sleep(500)
elif pin1.is_touched():
display.scroll("SAFE")
else:
display.show(Image.CHESSBOARD)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Add your Python code here. E.g.
from microbit import *

total = 0

while True:
if button_a.is_pressed():
total = total + 1
sleep(100)
display.scroll(total)
elif button_b.is_pressed():
total = total - 2
sleep(100)
display.show(total)
elif button_a.is_pressed() and button_b.is_pressed():
total = 0
sleep(100)
display.show(total)
else:
display.show(Image.SMILE)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Add your Python code here. E.g.
from microbit import *

display.scroll("The Food Quiz")
display.scroll("Get Ready")
sleep(2000)

#1
display.scroll("Q1")
display.scroll("Yes = A: No = B")
display.scroll("Do you eat chocolate every day?")

while True:
if button_a.is_pressed():
display.scroll("Too much")
display.show(Image.SAD)
sleep(2000)
break

elif button_b.is_pressed():
display.scroll("Good")
display.show(Image.SMILE)
sleep(2000)
break

#2
display.scroll("Q2")
display.scroll("Yes = A: No = B")
display.scroll("Do you sleep well?")

while True:
if button_a.is_pressed():
display.scroll("That is important")
display.show(Image.SMILE)
sleep(2000)
break

elif button_b.is_pressed():
display.scroll("Get some")
display.show(Image.SAD)
sleep(2000)
break
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added L20 Activity.docx
Binary file not shown.
Binary file added L20.pptx
Binary file not shown.
Binary file added Lesson_plan_20.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add your Python code here. E.g.
from microbit import *
import os

while True:
with open('hello.txt', 'w') as newFile:
if button_a.is_pressed():
newFile.write("Arch")
elif button_b.is_pressed():
newFile.write("Linux")
else:
pass

with open('hello.txt') as file:
output=file.readline()

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 number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Add your Python code here. E.g.
from microbit import *

while True:
temp = temperature()
if temp > 26:
display.scroll("Hot")
elif temp > 6 < 15:
display.scroll("Just right")
else:
display.scroll("Too cold")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if accelerometer.was_gesture('shake'):
display.scroll(temperature())
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Add your Python code here. E.g.
from microbit import *

light = display.read_light_level()
display.scroll(light)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Add your Python code here. E.g.
from microbit import *
from time import sleep

while True:
light = display.read_light_level()
display.scroll(light)
sleep(5)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Add your Python code here. E.g.
from microbit import *
from time import sleep

while True:
light = display.read_light_level()
if light > 20:
display.show(Image.HAPPY)
else:
display.show(Image.SAD)
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions Micro PET (13 to 24)/Micropython for microbit_L17_updated/torch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Add your Python code here. E.g.
from microbit import *

while True:
if button_a.is_pressed():
pin0.write_digital(1)
else:
pin0.write_digital(0)




Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Add your Python code here. E.g.
# radio 2
from microbit import *
import radio
radio.on()

# any channel from 0 to 100 can be used for privacy.
radio.config(channel=5)

while True:
msg = radio.receive()
if msg != None:
if msg == 'HAPPY':
display.show(Image.HAPPY)
sleep(200)
display.clear()
elif msg == 'SAD':
display.show(Image.SAD)
sleep(200)
display.clear()
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Add your Python code here. E.g.
#radio 1
from microbit import *

import radio
radio.on()

# any channel from 0 to 100 can be used for privacy.
radio.config(channel=5)

while True:
if button_a.was_pressed():
radio.send('HAPPY')
sleep(200)
elif button_b.was_pressed():
radio.send('SAD')
sleep(200)

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add your Python code here. E.g.
#radio 1
from microbit import *
import radio

radio.on()

radio.config(channel=5)

while True:
if button_a.was_pressed():
my_message = "A"
radio.send(my_message)
sleep(200)



Loading