Categories
Uncategorized

Blink Without Pause on the micro:bit

An important lesson in microcontroller programming…

If you’ve ever used an Arduino there’s a good chance you started with the Blink sketch, which is a great introduction to programming a physical computing device where you can see the outcome in the form a blinking LED. As you learn more and things get complex, you discover that using the delay statement in your code is not ideal as it prevents the code from continually running, so you can’t properly capture input to your microcontroller. There’s more over at the Blink Without Delay tutorial on this topic.

I’ve been doing a lot with the micro:bit lately, and my quick searches gave no equivalent for Blink Without Delay so I created Blink Without Pause.

The tutorial starts with micro:bit code for Blink With Pause (which is really just Blink) and then Blink Without Pause so you can compare the two.

For a real-world example there are two more, Blink With Pause With Button and then Blink Without Pause With Button which should clearly illustrate the value of not using pause if your code needs to do other things.

Oh, if you’re wondering where the micro:bit is in the illustrations above… it’s not there! The diagrams show the Bit Board that Brown Dog Gadgets will be releasing this fall as part of a Kickstarter campaign. Follow on Twitter, Instagram, or Facebook to see some of the other projects we’ve been doing and find out when the campaign launches.

Leave a Reply

Your email address will not be published. Required fields are marked *