Sequential Blinks


Did You Know: Simultaneous vs. Sequential

Up to this point, it looks like both lights change at the same instant.  In reality, the P13 light turned on a tiny fraction of a second before the P14 light.  That’s because the micro:bit executes statements in a script sequentially—one after another.  Since pin13.write_digital() comes before pin14.write_digital() in the script examples, the P13 light changes first. The P14 light changes an instant AFTER the P13 light.  

In the current script, the time between light changes for P13 and P14 is not visible to the human eye. You can make it visible by adding a sleep statement between the two write_digital() calls (along with other changes).


Your Turn: On/Off Sequentially

Sequential blinking takes a few more changes since the script has to turn one light on/off, and then turn the other light on/off afterwards.  In this approach, the script turns the P13 light on and off first, then follows with the P14 light.

  • Enter the led_blink_x2_sequential script shown below.
  • Update the name comment in the script and the Script Name field (python.microbit.org/v/2 matches the screencaptures).
  • Save your work by clicking Load/Save and then Download Project Hex.
  • Verify that the P13 light turns on and off, then the P14 light turns on and off.