Using the Adafruit_BBIO Library - Created by Justin Cooper
http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/using-the-bbio-library
This library has quite a few changes being made to it. Please read the CHANGELOG anytime you update the library to ensure it doesn't break your programs.
Using the Adafruit_BBIO library with the BeagleBone Black (BBB) is fairly simple, especially if you're familiar with the RPi.GPIO library for the Raspberry Pi.
To start, you'll want to import the libary. There are two different options at this time to import. The first one is for GPIO:
Copy Code
import Adafruit_BBIO.GPIO as GPIO
If you'd like to use PWM, then import as follows:
Copy Code
import Adafruit_BBIO.PWM as PWM
You can access the channels by either referencing the pin "key" or the name. If you look at your BeagleBone Black, you can see that each set of pin headers has a name, either P8 or P9. Then, you can see that there are pin numbers that start from 1, and go to 46.
When you count the pins, you don't go length-wise, but start at 1, then across to 2, and then back up to the next pin 3, and so on. The following image illustrates this a bit better:
BBB_pin_example.jpeg
So, to access the first pin on P9, you'd use "P9_1". You can also use the name of the pin to access it, which would be . You wouldn't want to do this though, as P9_1 is actually gnd! You'll want to view the last page of this guide to see which pins are available to use.
Not all pins are necessarily available. HDMI, and the eMMC flash module take up quite a few of them by default.
I2C is only compatible with Python2 due to the python-smbus dependency.
.END
No comments:
Post a Comment