Last active
June 10, 2017 15:59
-
-
Save davegoopot/33d2535e6f0a5047cb77fca2e349db56 to your computer and use it in GitHub Desktop.
Microbit flash an LED on pin0 to create a strobe effect
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
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