Skip to content

Instantly share code, notes, and snippets.

@VlastimilHovan
VlastimilHovan / pulse rate.py
Created November 30, 2016 18:30
BBC microbit pulse rate monitor (code release)
from microbit import *
analog_0 = 0
counter = 0
previous_running_time = 0
target = 20000
pulse = 0
remind = 0
while True:
@VlastimilHovan
VlastimilHovan / pov.py
Created November 30, 2016 19:43
BBC microbit persistence of vision (code release)
from microbit import *
time_ = 1
time_1 = 1
axis_x = 0
#Line 8,9,10,11,12 are not needed. It is only functionality check of my LEDs.
pin16.write_digital(1)
pin15.write_digital(1)
pin14.write_digital(1)
@VlastimilHovan
VlastimilHovan / maze game.py
Created November 30, 2016 20:04
BBC microbit maze game (code release)
from microbit import *
pin0.set_analog_period(10)
pin1.set_analog_period(10)
axis_old_x = 0
axis_old_y = 0
axis_x = 0 # plate
axis_y = 0 # base
@VlastimilHovan
VlastimilHovan / colour sensor.py
Created November 30, 2016 20:10
BBC microbit colour sensor (code release)
from microbit import *
analog_val = 0
while True:
analog_val = pin0.read_analog()
if (button_a.is_pressed() == True):
@VlastimilHovan
VlastimilHovan / maths game.py
Created December 1, 2016 19:57
BBC microbit maths game (code release)
#Written by Vlastimil Hovan 2016
#Please include text above in any redistribution
#Thanks
from microbit import *
import random
remind = -1
operation_ = 0
number_1 = 0
@VlastimilHovan
VlastimilHovan / measuring tape.py
Created December 1, 2016 20:06
BBC microbit digital measuring tape (code release)
# with this code you need to make hardware changes to sensor
# or you can add on code to disable pull resistor on pin16
from microbit import *
remind = 0
remind_1 = 0
counter = 0
display.scroll("Hello Girls")
@VlastimilHovan
VlastimilHovan / stopwatch.py
Created February 1, 2017 12:04
BBC microbit stopwatch
from microbit import *
def clear_line(line):
display.set_pixel(0, line, 0)
display.set_pixel(1, line, 0)
display.set_pixel(2, line, 0)
display.set_pixel(3, line, 0)
display.set_pixel(4, line, 0)
from microbit import *
time_ = 1
time_1 = 1
axis_x = 0
pin16.write_digital(1)
pin15.write_digital(1)
pin14.write_digital(1)
pin13.write_digital(1)
from microbit import *
analog_val = 0
analog_val_old = 0
#display.scroll("Simple Voltmeter with autorange.", delay=100)
while True:
analog_val = pin0.read_analog()
if (analog_val != (analog_val_old + 1)|(analog_val_old - 1)):
from microbit import *
analog_val = 0
analog_val_old = 0
while True:       
analog_val = pin0.read_analog()           
analog_val_old = analog_val   
analog_val = (analog_val * 0.0029297)