The Maker Show: Episode 13 - Breaking Out of the Loop

Infinite loops have been a centerpiece of programming since the first programs were written. Even "interactive" programs have infinite loops: program waits for input, program does some processing, program generates some output, program waits for input, and on and on and on.

While current generation microcontrollers like the popular Arduino variants still use loop-style programming, modern application platforms like those found on Windows, iOS and Android use event-driven or callback-style programming.

In this video we talk about why some areas of computing moved from loop-style to event-style and we cover patterns you can use to "break out of the loop" on Windows IoT Core.

[00:26] History of Loops to Events
[01:36] Events in UWP
[02:24] Sensors and Events in "Big Windows"
[03:05] Windows IoT Core and Interrupts
[04:40] Proximity Sensor and Debouncing IO Pins
[05:43] Timer Pattern
[06:51] Task Pattern
[08:39] Sensors and Events in the IoT.Devices Library
[12:39] Scheduler Pattern
[13:40] Scheduler and ScheduledUpdater in IoT.Devices Library
[14:41] Summary of Patterns and Options

The IoT.Devices library mentioned in this episode lives at aka.ms/IoTDevices and can be installed with NuGet using Microsoft.IoT.Devices. And if you missed it be sure to check out Rachel Weil's video on Adding a Coin Acceptor. It's the video we mentioned in this episode and it covers interrupts for breaking out of the loop on Arduino.

Finally, consider following:



and thanks for watching!