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

Chapter 7. Basic Input and Output

While the Raspberry Pi is, in essence, a very inexpensive Linux computer, there are a few things that distinguish it from laptop and desktop machines that we usually use for writing email, browsing the web, or word processing. One of the main differences is that the Raspberry Pi can be directly used in electronics projects because it has general purpose input and output pins right on the board, shown in Figure 7-1.

Raspberry Pi’s GPIO Pins
Figure 7-1. Raspberry Pi’s GPIO Pins

These GPIO pins can be accessed for controlling hardware such as LEDs, motors, and relays, which are all examples of outputs. As for inputs, your Raspberry Pi can read ...

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