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 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.