This chapter discusses the following functions of the Scheduler library for the Arduino Due:

  • startLoop()
  • yield()

The hardware needed to use these functions includes:

  • Arduino Due
  • LM35 temperature sensor
  • PowerSwitch Tail II (110 V or 220 V)
  • Adafruit's RGB LED Weatherproof flexi-strip (
  • 3 x TIP120 transistors
  • 3 x 100-Ω ¼-W resistors

NOTE The Scheduler library is only found in Arduino IDE version 1.5 and later. It is still considered experimental and under development.

You can find the code downloads for this chapter at on the Download Code tab. The code is in the Chapter 19 folder and the filename is Chapter19.ino.

Introducing Scheduling

Back in the early days of computing, computers could do only one thing at a time. When you turned on your trusty PC and put in a disk, the operating system started. Then you changed the disk and ran a spreadsheet. Your spreadsheet appeared on the screen after a few seconds and you heard some dubious sounds from the disk drive, and then, finally, you could get to work. If you wanted to take a break and play a game in glorious four colors, you had to save your work and quit the spreadsheet (or in some cases, actually restart the computer) before playing a game. With disks, this didn't matter so much; you couldn't have two programs open at the same time.

When graphical systems arrived on the PC, users wanted to have windows containing their applications, ...

Get Arduino Sketches: Tools and Techniques for Programming Wizardry now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.