Chapter 2. Making the Sketch Do Your Bidding
Though much of an Arduino project will involve integrating the Arduino board with supporting hardware, you need to be able to tell the board what to do with the rest of your project. This chapter introduces core elements of Arduino programming, showing nonprogrammers how to use common language constructs and providing an overview of the language syntax for readers who are not familiar with C or C++, the language being used.
Since making the examples interesting requires making Arduino do something, the recipes use physical capabilities of the board that are explained in detail in later chapters. If any of the code in this chapter is not clear, feel free to jump forward, particularly to Chapter 4 for more on serial output and Chapter 5 for more on using digital and analog pins. You don’t need to understand all the code in the examples, though, to see how to perform the specific capabilities that are the focus of the recipes. Here are some of the more common functions used in the examples that are covered in the next few chapters:
Prints the value to the Serial Monitor on your computer; see Recipe 4.1
Reads a digital value (
LOW) on a pin set for input; see Recipe 5.1
Writes the digital value (
LOW) to a pin set for output; ...