Chapter 7. Analog-to-Digital Conversion I

If there’s one thing I like about microcontrollers, it’s connecting the real world with the code world. And a lot of the real world is analog: voltages, currents, light levels, forces, etc., all take on continuously variable values. Deep inside the AVR, on the other hand, everything is binary: on or off. Going from the analog world to the digital is the job of the analog-to-digital converter (ADC) hardware. Using the built-in ADC, we’ll see how to use the AVR to take (voltage) readings from analog sensors and turn them into numbers that we can use inside our code.

Imagine that you’re building a robot or an interactive art piece. You might be interested in measuring temperature, ...

Get Make: AVR Programming now with the O’Reilly learning platform.

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