Skip to content

Instantly share code, notes, and snippets.

@davegoopot
Last active June 10, 2017 15:59
Show Gist options
  • Save davegoopot/33d2535e6f0a5047cb77fca2e349db56 to your computer and use it in GitHub Desktop.
Save davegoopot/33d2535e6f0a5047cb77fca2e349db56 to your computer and use it in GitHub Desktop.
Microbit flash an LED on pin0 to create a strobe effect
from microbit import *
def flash():
pin0.write_digital(True)
FLASH_DURATION = 1
sleep(FLASH_DURATION)
pin0.write_digital(False)
flashes_per_second = 10
flash_wait_ms = 1000 / flashes_per_second
while True:
flash()
sleep(flash_wait_ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment