CHAPTER19

Scheduler

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 (http://www.adafruit.com/products/346)
  • 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 http://www.wiley.com/go/arduinosketches 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.