C H A P T E R  7

Advanced Functions

So far we've covered not only the structure and syntax of programming Arduino's C-based programming language, but we've also examined many of the Arduino library's basic functions for reading and writing to digital and analog input and output pins. In this chapter, we will build on this foundation to catch up with some of the more advanced topics surrounding functions, including a look at a few functions that we haven't had the opportunity to cover so far in this book. We'll also cover how to write our own functions, including how functions work, as well as how to use a special kind of function called an interrupt service routine that works with the Arduino's hardware interrupt pins.

Let's begin with a discussion of the timing functions, such as delay() and millis(), followed by the functions for generating random numbers, before looking at our next project, Ambient Temps. We will then discuss writing and using your own functions followed by a second project, HSB Color Mixer, to demonstrate hardware interrupts in action.

What's needed for this chapter:

  • Arduino Uno
  • BlinkM MinM smart LED
  • TMP36 temperature sensor
  • 1 microfarad electrolytic capacitor or similar
  • 10 kilohm trimpot or linear potentiometer
  • 10 kilohm ¼ watt resistor or similar
  • Momentary pushbutton or switch
  • Hookup wires
  • Solderless breadboard
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset