Skip to content

Code Building Blocks: Non-blocking timers

Photo of Malcolm Knapp
Hosted By
Malcolm K.
Code Building Blocks: Non-blocking timers

Details

Hello Makers,

This month we will look at one of the basic building blocks for embedded systems, though it may not seem like much, the non-blocking timer (https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay). Non-blocking timers mean you register a button press while blinking an LED or run a servo while updating an LCD, and so forth. Basically, if you want to do anything beyond Hello World you need them.

https://secure.meetupstatic.com/photos/event/a/a/2/8/600_460723560.jpeg

If you do not use a non-blocking timer what you use is something like the Arduino delay function (https://www.arduino.cc/en/reference/delay). This works great if all you want to do is blink a LED but the moment you want to do more it fails. To see what the issue is look at this example (https://circuits.io/circuits/3496305-blocking-timer) and try to use the button to turn on the red LED. This behavior happens because delay is a blocking function which means the process waits for the function to end before any other code can execute. We will go over how non-blocking timers solve this problem, how to create your own, and some libraries that can speed you up.

The demo will take the first half an hour. Then there will be open project time to work on any project you want. You can work on one the previous projects (https://github.com/theengineeraccelerator/Beyond-Hello-World) or bring your own.

See you there!

--------------

Thanks for coming to to Beyond Hello World Electronics! Please note that children under 14 need to be accompanied by an adult.

This project is part of The Engineer Accelerator (http://www.engineeraccelerator.com/) - Where hardware engineers get trained in industry metaskills and processes.

Photo of Beyond Hello World Electronics group
Beyond Hello World Electronics
See more events
The Port Workspaces
344 20th St · Oakland, CA