Book Image

Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)

By : Dan Nixon
Book Image

Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)

By: Dan Nixon

Overview of this book

Table of Contents (18 chapters)
Getting Started with Python and Raspberry Pi
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Universal Asynchronous Receiver/Transmitter (UART)


The Raspberry Pi also has a Universal Asynchronous Receiver/Transmitter (UART) connection on the GPIO header that can be used to interface with external hardware (such as an Arduino). Fortunately, it is easy to use through the pySerial Python library (https://pypi.python.org/pypi/pyserial), which provides access to the serial ports on a variety of platforms.

Setting up the serial port

Before we can use the serial port on the Raspberry Pi, there are a couple of configuration files that must first be changed to stop Raspbian from using the port as an additional terminal, which would otherwise cause communication issues if another piece of software attempted to use the port.

The first file that requires modification is /boot/cmdline.txt. Open this file as root using the following command in the terminal:

sudo nano /boot/cmdline.txt

Here, we need to remove console=ttyAMA0,115200 from the single line of the file; doing so tells the Pi not to use...