In the next chapter, we'll look at more robust ways to begin using the GPIO pin library. In the meantime, let's wrap up by doing an on board LED blink similar to the recipe we did earlier in the chapter.
However, instead of BoneScript, we'll do a variation of the recipe in Python and specifically pull on the PyBBIO library's functionality. This recipe will work on both Debian Wheezy and Jessie.
Perform the following steps to run Python scripts to control LEDs:
Open up LXTerminal.
Create a python project directory within the
bbb_recipe_book
directory and navigate to it as follows:mkdir python cd bbb_recipe_book/projects/python
Create a new Python file using the following code (note the
.py
file format):sudo nano major_tom_blinks.py
Copy and paste the following code into the window:
#!/usr/bin/python # Blinks one of the Beaglebone Black's on-board LEDs until CTRL-C is pressed. These LEDs include USR0, USR1, USR2, USR3 # Import PyBBIO...