Script and Tests

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

Script: led_blink_x2

  • If it's not already connected, connect your micro:bit module to your computer with the USB cable.
  • If you do not already have the micro:bit Python Editor open, browse to python.microbit.org in a Google Chrome or Microsoft Edge browser.
  • Set the project name field to led_blink_x2.  
  • Update your script to match the one below, then click Save.
  • Click Send to micro:bit.
# 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.