Chapter 5. Working with Functions

In this chapter you will

  • Create your own functions

  • Learn to make decisions with while and do-while

  • Send and receive data between your Arduino and the Serial Monitor window

  • Learn about long variables

You’ll learn new methods to make your Arduino sketches easier to read and simpler to design by creating your own functions. You can also create modular, reusable code that will save you time again and again. We’ll introduce a way to make decisions that control blocks of code, and you’ll learn about a type of integer variable called the long. Then you will use your own functions to create a new type of thermometer.

A function consists of a set of instructions that we can use anywhere in our sketches. Although many functions ...

Get Arduino Workshop now with O’Reilly online learning.

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