Input: Converting Analog to Digital
Just like you controlled the output of a GPIO pin on a scale of 0 to
100, it’s also possible to read sensors that can offer the Raspberry
Pi a range of values. If you want to know the temperature outdoors,
the light level of a room, or the amount of pressure on a resistive
pad, you can use various sensors. On a microcontroller like the
Arduino, there’s special hardware to convert the analog voltage
level to digital data. Unfortunately, your Raspberry Pi doesn’t have
this hardware built-in.
This section will show you how to convert from analog to digital
using an
ADC
, or
analog-to-digital converter
. There are a few differ-
ent models of ADCs out there, but this chapter will use the ...