You are previewing Getting Started with Raspberry Pi.

Getting Started with Raspberry Pi

Cover of Getting Started with Raspberry Pi by Matt Richardson... Published by Maker Media, Inc
  1. A Note Regarding Supplemental Files
  2. Preface
    1. What Can You Do With It?
    2. Raspberry Pi for Makers
    3. Linux and Raspberry Pi
    4. What Others Have Done With It
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgements
  3. 1. Getting Up and Running
    1. A Tour of the Boards
    2. The Proper Peripherals
    3. The Case
    4. Choose Your Distribution
    5. Flash the SD Card
    6. Booting Up
    7. Configuring Your Pi
    8. Shutting Down
    9. Troubleshooting
    10. Going Further
  4. 2. Getting Around Linux on the Raspberry Pi
    1. Using the Command Line
      1. Files and the Filesystem
    2. More Linux Commands
      1. Processes
      2. Sudo and Permissions
      3. The Network
    3. /etc
    4. Setting the Date and Time
    5. Installing New Software
    6. Going Further
  5. 3. Python On The Pi
    1. Hello Python
    2. A Bit More Python
    3. Objects and Modules
    4. Even More Modules
    5. Troubleshooting Errors
    6. Going Further
  6. 4. Animation and Multimedia in Python
    1. Hello Pygame
    2. Pygame Surfaces
    3. Drawing on Surfaces
    4. Handling Events and Inputs
    5. Sprites
    6. Playing Sound
    7. Playing Video
    8. Further Reading
  7. 5. Scratch on the Pi
    1. Hello Scratch
    2. The Stage
    3. Two More Things to Know About Sprites
    4. A Bigger Example: Astral Trespassers
    5. Scratch and the Real World
    6. Sharing Your Programs
    7. Going Further
  8. 6. Arduino and the Pi
    1. Installing Arduino in Raspbian
      1. Finding the Serial Port
    2. Talking in Serial
    3. Going Further
  9. 7. Basic Input and Output
    1. Using Inputs and Outputs
      1. Digital Output: Lighting Up an LED
      2. Digital Input: Reading a Button
    2. Project: Cron Lamp Timer
      1. Scripting Commands
      2. Connecting a Lamp
      3. Scheduling Commands with cron
    3. Going Further
  10. 8. Programming Inputs and Outputs with Python
    1. Installing and Testing GPIO in Python
    2. Blinking an LED
    3. Reading a Button
    4. Project: Simple Soundboard
    5. Going Further
  11. 9. Working with Webcams
    1. Testing Webcams
    2. Installing and Testing SimpleCV
    3. Displaying an Image
    4. Modifying an Image
    5. Accessing the Webcam
    6. Face Detection
    7. Project: Raspberry Pi Photobooth
    8. Going Further
  12. 10. Python and The Internet
    1. Download Data from a Web Server
      1. Fetching the Weather Forecast
    2. Serving Pi (Be a Web Server)
      1. Flask Basics
    3. Connecting the Web to the Real World
    4. Project: WebLamp
    5. Going Further
  13. A. Writing an SD Card Image
    1. Writing an SD card from OS X
    2. Writing an SD card from Windows
    3. Writing an SD card from Linux
  14. B. Astral Trespassers Complete
  15. C. Analog Input
    1. Converting Analog to Digital
  16. About the Authors
  17. Colophon
  18. Copyright
O'Reilly logo

Appendix C. Analog Input

In this book, you learned about digital inputs and outputs with buttons, switches, LEDs and relays. Each of these components were 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.

Unfortunately, you can’t read these types of sensors directly on the Raspberry Pi since there are only digital inputs on the board. But you’re not totally out of luck; there are a few different ways of using additional components to read analog sensors using the Pi’s digital inputs.

Converting Analog to Digital

To convert from analog to digital, this appendix will show you how ...

The best content for your career. Discover unlimited learning on demand for around $1/day.