Chapter 5. Simple Digital and Analog Input
The Arduino’s ability to sense digital and analog inputs allows it to respond to you and to the world around you. This chapter introduces techniques you can use to do useful things with these inputs. This is the first of many chapters to come that cover electrical connections to Arduino. If you don’t have an electronics background, you may want to look through Appendix A on electronic components, Appendix B on schematic diagrams and data sheets, Appendix C on building and connecting circuits, and Appendix E on hardware troubleshooting. In addition, many good introductory tutorials are available covering electronics. Two that are particularly relevant to Arduino are Getting Started with Arduino by Massimo Banzi (O’Reilly) and Making Things Talk by Tom Igoe (O’Reilly). Other books offering a background on electronics topics covered in this and the following chapters include Getting Started in Electronics by Forrest Mims (Master Publishing) and Physical Computing by Tom Igoe (Cengage).
If wiring components to your Arduino is new to you, be careful about how you connect and power the things you attach. Arduino uses a robust controller chip that can take a fair amount of abuse, but you can damage the chip if you connect the wrong voltages or short-circuit an output pin. Most Arduino controller chips are powered by 5 volts, and you must not connect external power to Arduino pins with a higher voltage than this (or 3.3 volts ...