O'Reilly logo

Programming the BeagleBone by Yogesh Chavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Program to read/write on UART

UART implementation inside the Adafruit Python library has methods to set up and start UART channels, load an appropriate device tree and to clean up. It does not provide actual UART read/write methods as they are already part of the Python module "pyserial." There is a need for a "pyserial" Python module installation to read/write on the UART channel. Run the following command:

sudo pip install pyserial

Connect pin "P9_24" (TX pin of UART1) to "P9_11" (RX pin of UART4) using a jumper wire. Type the following two programs in Cloud9, save them as UART1.py and UART4.py. Run UART4.py first. Then run UART1.py. You should see Hello World printed on the output window of program UART4.py.

This the code for UART1.py:

#!/usr/bin/python ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required