-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
150 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ | |
print("INFO: NORTH WEST is between 292°-270°, 270°-248°") | ||
display.show(Image.ARROW_NW) | ||
|
||
sleep(1000) | ||
sleep(1_000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
# Imports go at the top | ||
from microbit import * | ||
import log | ||
from microbit import * | ||
|
||
print("INFO: spining wheel while we log data") | ||
print("INFO: data is in MY_DATA.HTM file") | ||
print("INFO: ok, the interactive log file is pretty cool") | ||
|
||
log.set_labels('temperature', 'sound', 'light') | ||
log.set_labels("temperature", "sound", "light") | ||
|
||
print("INFO: mirroring log to console") | ||
log.set_mirroring(True) | ||
|
||
|
||
@run_every(s=5) | ||
def log_data(): | ||
log.add({ | ||
'temperature': temperature(), | ||
'sound': microphone.sound_level(), | ||
'light': display.read_light_level() | ||
}) | ||
log.add({"temperature": temperature(), "sound": microphone.sound_level(), "light": display.read_light_level()}) | ||
|
||
|
||
while True: | ||
display.show(Image.ALL_CLOCKS) | ||
sleep(1000) | ||
sleep(1_000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ | |
print("INFO: dot=" + str(dot)) | ||
display.set_pixel(*dot) | ||
|
||
sleep(1000) | ||
sleep(1_000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
# Imports go at the top | ||
from microbit import * | ||
|
||
|
||
# Code in a 'while True:' loop repeats forever | ||
while True: | ||
for sound in dir(Sound): | ||
if sound.isupper(): | ||
print("sound: " + sound) | ||
audio.play(getattr(Sound, sound)) | ||
sleep(1000) | ||
if sound.isupper(): | ||
print("sound: " + sound) | ||
audio.play(getattr(Sound, sound)) | ||
sleep(1_000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
# Imports go at the top | ||
from microbit import * | ||
import log | ||
from microbit import * | ||
|
||
print("INFO: spining wheel while we log data") | ||
print("INFO: data is in MY_DATA.HTM file") | ||
print("INFO: ok, the interactive log file is pretty cool") | ||
|
||
log.set_labels('x', 'y', 'z') | ||
log.set_labels("x", "y", "z") | ||
|
||
print("INFO: mirroring log to console") | ||
log.set_mirroring(True) | ||
|
||
print("INFO: shake the microbit") | ||
|
||
|
||
@run_every(s=1) | ||
def log_data(): | ||
log.add({ | ||
'x': accelerometer.get_x(), | ||
'y': accelerometer.get_y(), | ||
'z': accelerometer.get_z(), | ||
}) | ||
log.add( | ||
{ | ||
"x": accelerometer.get_x(), | ||
"y": accelerometer.get_y(), | ||
"z": accelerometer.get_z(), | ||
} | ||
) | ||
|
||
|
||
while True: | ||
display.show(Image.ALL_CLOCKS) | ||
sleep(1000) | ||
sleep(1_000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
# Imports go at the top | ||
from microbit import * | ||
|
||
|
||
# Code in a 'while True:' loop repeats forever | ||
while True: | ||
for image in dir(Image): | ||
if image.isupper(): | ||
print("image: " + image) | ||
display.show(getattr(Image, image)) | ||
sleep(5000) | ||
if image.isupper(): | ||
print("image: " + image) | ||
display.show(getattr(Image, image)) | ||
sleep(5_000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.