Easy access to hardware

This recipe demonstrates how simple it is to access hardware from a Raspberry Pi.

In this recipe, an LED connected to one of the Raspberry Pi's GPIO pins is made to blink using simple Bash commands (ls, cat, and echo).

After completing this recipe, you will be able to control the GPIO ports attached to your Raspberry Pi from the Bash command line.

Getting ready


  • An Initial Setup or Basic Networking setup for the Raspberry Pi that is not powered on
  • An LED
  • A pushbutton switch
  • Three 330 Ohm resisters
  • A breadboard
  • A few breadboarding wires

This recipe does not require the desktop GUI and could either be run from the text-based console or from within an LXTerminal.

If the Raspberry Pi's Secure Shell server is running, this ...

Get Raspberry Pi Networking Cookbook - Second Edition now with O’Reilly online learning.

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