Chapter 8. Analog Input and Output

In Chapter 6, you learned about digital inputs and outputs with buttons, switches, LEDs, and relays. Each of these components was always either on or off, never anything in between. However, you might want to sense things in the world that are not necessarily one or the other—for instance, temperature, distance, light levels, or the status of a dial. These all come in a range of values.

Or you may want to put something in a state that’s not just on or off. For example, if you wanted to dim an LED or control the speed of a motor rather than just turning it on or off. To make an analogy for analog and digital, you can think of a typical light switch versus a dimmer switch, as pictured in Figure 8-1.

Figure 8-1. ...

Get Getting Started With Raspberry Pi, 3rd Edition now with O’Reilly online learning.

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