Skip to content

Instantly share code, notes, and snippets.

@dmpop
Last active August 3, 2016 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmpop/6c089678e6bc9462cccbbf11019aca57 to your computer and use it in GitHub Desktop.
Save dmpop/6c089678e6bc9462cccbbf11019aca57 to your computer and use it in GitHub Desktop.
BBC micro:bit-based intervalometer
from microbit import *
a = 0
b = 0
while True:
if button_a.is_pressed():
a = a + button_a.get_presses()
display.scroll(str(a))
if button_b.is_pressed():
b = b + button_b.get_presses()
display.scroll(str(b))
gesture = accelerometer.current_gesture()
if gesture == "shake":
while (a > 0):
display.scroll(str(a))
display.show(Image.ASLEEP)
pin8.write_digital(1)
sleep(500)
pin8.write_digital(0)
sleep(b*1000)
display.clear()
a = a - 1
else:
display.scroll("All done!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment