Script: led_blink_list
This script will blink the LEDs in sequence according to a list named pin_list.
- Set the project name field to led_blink_list.
- Enter script below into the micro:bit Python Editor, and then click Save.
- Click Send to micro:bit.
# led_blink_list from microbit import * pin_list = [pin13, pin14, pin15] while True: for pin in pin_list: pin.write_digital(1) sleep(500) pin.write_digital(0)
Tests
- Verify that the lights repeat the same sequence over and over: green for 0.5 s, yellow for 0.5 s, and then red for 0.5 s.
- Try changing sleep(500) to sleep(100) and flash the modified script. Did you anticipate the effect of this change correctly?