CHAPTER2

Programming for the Arduino

The Arduino is an embedded system, that is to say it has the minimum amount of hardware to get the job done. That does not mean that it is by any means a weak system; there is no point in having a PCI bus if it will never be used—it will only take up space, energy, and increase the overall cost of the device. Arduinos are lightweight—and inexpensive—and make excellent embedded systems. Just like all embedded systems, programming is done on a host computer, not the Arduino itself.

Programming an embedded system, and indeed programming any sort of system, is the art of writing text that can be understood by a human, and translating it into a binary file that can be understood by a processor. For this, some tools are required. The data written by humans is called source code, and because most source code is in text format, sometimes a simple text editor is enough. Most people go with an Integrated Development Environment (IDE), an augmented text editor with add-ons designed for developers. These add-ons can range from text auto-completion to debugging and often include tools to handle different types of source files, which contain source code. Some projects might use only one file, but large projects can sometimes have hundreds of files, if not thousands. After the source code is written, a compiler must be used, which reads in the source code and creates one or more binary files. These binary files are later uploaded onto the Arduino and run by ...

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.