Adafruit BBIO Python Library
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 8
- Joined: Mon Apr 21, 2014 5:11 am
Adafruit BBIO Python Library
How do I see the contents or the source code inside the BBIO library? Or do I only need high and lows to have full functionality of my board?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit BBIO Python Library
The source code is available here:
https://github.com/adafruit/adafruit-be ... -io-python
https://github.com/adafruit/adafruit-be ... -io-python
-
- Posts: 8
- Joined: Mon Apr 21, 2014 5:11 am
Re: Adafruit BBIO Python Library
Thank you. I noticed that was there but I didn't know how to open it or use it. I kindly ask if you could explain it to me.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit BBIO Python Library
There will be a Download Zip button on the right hand side of the screen. Alternately, you can click on the file/folder names to view the contents of the files.
You might also want to have a look at our WebIDE, which can make working with our library code very easy:
https://learn.adafruit.com/webide
You might also want to have a look at our WebIDE, which can make working with our library code very easy:
https://learn.adafruit.com/webide
-
- Posts: 7
- Joined: Mon Mar 24, 2014 9:20 pm
Re: Adafruit BBIO Python Library
I'm really confused about the ADAFRUIT BBIO library.
The documentation is really sparse for UART functions.
So when I search for other examples on the web, some are over 2 yrs old, don't apply to the BBB, are Angstrom (I moved to Debian, but that shouldn't matter to python), are more Arduino oriented, etc etc.
here's my two main questions:
1) Do I have to fool around with all the MUX calculations & .dts files, etc. or is that handled for me in ADAFRUIT.BBIO ?
2) Am I supposed to refer to pyserial for all my serial commands?
At this point, I'm trying to read simple packet data from an XBEE - I see my data arriving when I use XCTU. But nothing is coming into the BBB through the RX pin - as observed by "minicom". The python program doesn't do anything - which would be normal if no data is coming in according to "minicom".
I even saw a lengthy article where a guy swears UART2 is /dev/ttyO1 , but I've been under the impression that its /dev/TTYO2.
Makes you want to give up and go down a tried and tested Arduino route.
J
The documentation is really sparse for UART functions.
So when I search for other examples on the web, some are over 2 yrs old, don't apply to the BBB, are Angstrom (I moved to Debian, but that shouldn't matter to python), are more Arduino oriented, etc etc.
here's my two main questions:
1) Do I have to fool around with all the MUX calculations & .dts files, etc. or is that handled for me in ADAFRUIT.BBIO ?
2) Am I supposed to refer to pyserial for all my serial commands?
At this point, I'm trying to read simple packet data from an XBEE - I see my data arriving when I use XCTU. But nothing is coming into the BBB through the RX pin - as observed by "minicom". The python program doesn't do anything - which would be normal if no data is coming in according to "minicom".
I even saw a lengthy article where a guy swears UART2 is /dev/ttyO1 , but I've been under the impression that its /dev/TTYO2.
Makes you want to give up and go down a tried and tested Arduino route.
J
- jwcooper
- Posts: 1004
- Joined: Tue May 01, 2012 9:08 pm
Re: Adafruit BBIO Python Library
Hey jaymer,
1) BBIO will handle the MUX calculations and dts files for you. It will export them as well, etc. The overlays used can be found in our repository on github.
2) BBIO doesn't handle anything with serial. You'll want to continue using pyserial.
UART2 should be /dev/ttyO2
The beaglebone is definitely a little more trial and error than the Arduino at this point. It has gotten a LOT better lately though. :)
1) BBIO will handle the MUX calculations and dts files for you. It will export them as well, etc. The overlays used can be found in our repository on github.
2) BBIO doesn't handle anything with serial. You'll want to continue using pyserial.
UART2 should be /dev/ttyO2
The beaglebone is definitely a little more trial and error than the Arduino at this point. It has gotten a LOT better lately though. :)
-
- Posts: 8
- Joined: Mon Apr 21, 2014 5:11 am
Re: Adafruit BBIO Python Library
Hi again.
I want to know if there's more functions contained within the Adafruit BBIO GPIO module. I only know how to use the GPIO.setup() and other functions described in this Adafruit learning blog.
I want to know if there's more functions contained within the Adafruit BBIO GPIO module. I only know how to use the GPIO.setup() and other functions described in this Adafruit learning blog.
- jwcooper
- Posts: 1004
- Joined: Tue May 01, 2012 9:08 pm
Re: Adafruit BBIO Python Library
Those are pretty much it. There are a couple more functions, but not usually very useful for most projects.
Code: Select all
PyMethodDef gpio_methods[] = {
{"setup", (PyCFunction)py_setup_channel, METH_VARARGS | METH_KEYWORDS, "Set up the GPIO channel, direction and (optional) pull/up down control\nchannel - Either: RPi board pin number (not BCM GPIO 00..nn number). Pins start from 1\n or : BCM GPIO number\ndirection - INPUT or OUTPUT\n[pull_up_down] - PUD_OFF (default), PUD_UP or PUD_DOWN\n[initial] - Initial value for an output channel"},
{"cleanup", py_cleanup, METH_VARARGS, "Clean up by resetting all GPIO channels that have been used by this program to INPUT with no pullup/pulldown and no event detection"},
{"output", py_output_gpio, METH_VARARGS, "Output to a GPIO channel\ngpio - gpio channel\nvalue - 0/1 or False/True or LOW/HIGH"},
{"input", py_input_gpio, METH_VARARGS, "Input from a GPIO channel. Returns HIGH=1=True or LOW=0=False\ngpio - gpio channel"},
{"add_event_detect", (PyCFunction)py_add_event_detect, METH_VARARGS | METH_KEYWORDS, "Enable edge detection events for a particular GPIO channel.\nchannel - either board pin number or BCM number depending on which mode is set.\nedge - RISING, FALLING or BOTH\n[callback] - A callback function for the event (optional)\n[bouncetime] - Switch bounce timeout in ms for callback"},
{"remove_event_detect", py_remove_event_detect, METH_VARARGS, "Remove edge detection for a particular GPIO channel\ngpio - gpio channel"},
{"event_detected", py_event_detected, METH_VARARGS, "Returns True if an edge has occured on a given GPIO. You need to enable edge detection using add_event_detect() first.\ngpio - gpio channel"},
{"add_event_callback", (PyCFunction)py_add_event_callback, METH_VARARGS | METH_KEYWORDS, "Add a callback for an event already defined using add_event_detect()\ngpio - gpio channel\ncallback - a callback function\n[bouncetime] - Switch bounce timeout in ms"},
{"wait_for_edge", py_wait_for_edge, METH_VARARGS, "Wait for an edge.\ngpio - gpio channel\nedge - RISING, FALLING or BOTH"},
{"gpio_function", py_gpio_function, METH_VARARGS, "Return the current GPIO function (IN, OUT, ALT0)\ngpio - gpio channel"},
{"setwarnings", py_setwarnings, METH_VARARGS, "Enable or disable warning messages"},
{NULL, NULL, 0, NULL}
-
- Posts: 8
- Joined: Mon Apr 21, 2014 5:11 am
Re: Adafruit BBIO Python Library
Thank you this is what I needed. I am making an ROV (Underwater) and I'm wondering if this is all I need to control motors and analog sensors. Also, how did you read the files inside the modules? For example if I wanted to see whats inside PWM and analog modules, can you show me how to read use python (desktop based, not on BBB) to read it?
- jwcooper
- Posts: 1004
- Joined: Tue May 01, 2012 9:08 pm
Re: Adafruit BBIO Python Library
Glad I could help. The easiest way to view the files is on Github. For example, here is the PWM method definitions:
https://github.com/adafruit/adafruit-be ... pwm.c#L173
https://github.com/adafruit/adafruit-be ... pwm.c#L173
-
- Posts: 8
- Joined: Mon Apr 21, 2014 5:11 am
Re: Adafruit BBIO Python Library
jwcooper wrote:Glad I could help. The easiest way to view the files is on Github. For example, here is the PWM method definitions:
https://github.com/adafruit/adafruit-be ... pwm.c#L173
Thank you! This is exactly what I need!
- jdawg
- Posts: 23
- Joined: Fri Jul 20, 2012 10:53 pm
Re: Adafruit BBIO Python Library
Your website says that the BBIO Python Library has only been tested with Angstrom and Ubuntu.
I am assuming that it works with Debian, am I correct?
I am assuming that it works with Debian, am I correct?
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Adafruit BBIO Python Library
It should.. Ubuntu is based off of Debian. Linux distros are fairly aggressive about changing things under the hood though, so YMMV.
Please be positive and constructive with your questions and comments.