Getting Started with Raspberry Pi

Page 118

In Chapter 7, you learned that digital input and output signals on the Raspberry Pi must be either 3.3 volts or ground. In digital electronics, we refer to these signals as high or low respectively. Keep in mind that not all hardware out there uses 3.3 volts to indicate high; some use 1.8 volts or 5 volts. If you plan on connecting your Raspberry Pi to digital hardware through its GPIO pins, it’s important that they also use 3.3 volts. Those steps gave you a rough idea of how to control the GPIO pins by typing in Python statements directly into the interactive interpreter. Just like how you created a shell script to turn the pins on and off in Chapter 7, you’re going to create a Python script to read and control the pins automatically.

Blinking an LED To blink an LED on and off with Python, you’re going to use the statements that you already tried in the interactive interpreter in addition to a few others. For the next few steps, we’ll assume you’re using desktop environment, but feel free to use the command line to write and execute these Python scripts if you prefer.

Figure 8-1. Creating a new file in the home directory 1. Open the File Manager by clicking its icon in the task bar. 2. Be sure you’re in the home directory, the default being /home/pi. If not, click on the home icon under the Places listing.

102

Getting Started with Raspberry Pi


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.