Script and Tests

This script will test your LED circuits by blinking them on/off together.

Script: led_blink_x2

  • Enter the led_blink_x2 script (python.microbit.org/v/2 matches the screencaptures).
  • Set the Script Name field to led_blink_x2.
  • Click Load/Save, and then click Download Project Hex to save your work.  
  • Close the Load/Save dialog box after downloading.
# led_blink_x2

from microbit import *

while True:
    pin13.write_digital(1)
    pin14.write_digital(1)
    sleep(500)
    pin13.write_digital(0)
    pin14.write_digital(0)
    sleep(500)

Tests: On/Off Together

  • Verify that BOTH LEDs blink on/off once every second.
  • Try changing the sleep(500) to sleep(250) in both calls and verify that both LED’s blink in unison, twice as fast.