Skip to content

Commit 325389a

Browse files
authored
Update README.md
1 parent c706e9f commit 325389a

File tree

1 file changed

+37
-43
lines changed

1 file changed

+37
-43
lines changed

README.md

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,38 @@
1-
**PLEASE NOTE: This library may have breaking changes as development continues. Please read the changelog anytime you update the library!**
2-
3-
**The PWM Duty Cycle range was reversed in 0.0.15 from 100(off)-0(on) to 0(off)-100(on). Please update your code accordingly.**
4-
5-
**Adafruit's BeagleBone IO Python Library**
1+
# Adafruit's BeagleBone IO Python Library
62

73
This is a set of Python tools to allow GPIO, PWM, and ADC access on the BeagleBone using the Linux 3.8 Kernel and above (latest releases).
84

95
It is recommended to use an official BeagleBoard.org Debian image:
106
https://beagleboard.org/latest-images
117

12-
**Note: BBIO has been renamed to Adafruit_BBIO.**
138

14-
**Installation on Ubuntu/Debian**
9+
**NOTE: This library may have breaking changes as development continues. Please read the changelog.**
1510

16-
Easiest::
11+
## Installation on Debian**
1712

18-
sudo ntpdate pool.ntp.org
19-
sudo apt-get update
20-
sudo apt-get install build-essential python-dev python-pip -y
21-
#easy_install -U distribute //debian only
22-
sudo pip install Adafruit_BBIO
13+
Easiest:
14+
```
15+
sudo ntpdate pool.ntp.org
16+
sudo apt-get update
17+
sudo apt-get install build-essential python-dev python-pip -y
18+
sudo pip install Adafruit_BBIO
19+
```
2320

24-
Manual::
25-
26-
sudo ntpdate pool.ntp.org
27-
sudo apt-get update
28-
sudo apt-get install build-essential python-dev python-pip -y
29-
git clone git://github.com/adafruit/adafruit-beaglebone-io-python.git
30-
cd adafruit-beaglebone-io-python
31-
sudo python setup.py install
32-
cd ..
33-
sudo rm -rf adafruit-beaglebone-io-python
21+
Manual:
22+
```
23+
sudo ntpdate pool.ntp.org
24+
sudo apt-get update
25+
sudo apt-get install build-essential python-dev python-pip -y
26+
git clone git://github.com/adafruit/adafruit-beaglebone-io-python.git
27+
cd adafruit-beaglebone-io-python
28+
sudo python setup.py install
29+
```
3430

35-
**Usage**
31+
## Usage
3632

3733
Using the library is very similar to the excellent RPi.GPIO library used on the Raspberry Pi. Below are some examples.
3834

39-
**GPIO Setup**
35+
### GPIO Setup
4036

4137
Import the library, and setup as GPIO.OUT or GPIO.IN::
4238

@@ -47,15 +43,15 @@ You can also refer to the pin names::
4743

4844
GPIO.setup("GPIO0_26", GPIO.OUT)
4945

50-
**GPIO Output**
46+
### GPIO Output
5147

5248
Setup the pin for output, and write GPIO.HIGH or GPIO.LOW. Or you can use 1 or 0.::
5349

5450
import Adafruit_BBIO.GPIO as GPIO
5551
GPIO.setup("P8_14", GPIO.OUT)
5652
GPIO.output("P8_14", GPIO.HIGH)
5753

58-
**On-Board LEDs**
54+
### On-Board LEDs
5955

6056
On-board LEDs (USR0-USR3) are handled by LED class driver rather than the GPIO pin driver.
6157

@@ -77,37 +73,38 @@ Setup the pin for output and write GPIO.HIGH or GPIO.LOW::
7773
GPIO.output("USR%d" % i, GPIO.LOW)
7874
time.sleep(1)
7975

80-
**GPIO Input**
76+
### GPIO Input
8177

82-
Inputs work similarly to outputs.::
78+
Inputs work similarly to outputs.:
8379

8480
import Adafruit_BBIO.GPIO as GPIO
8581
GPIO.setup("P8_14", GPIO.IN)
8682

87-
Polling inputs::
83+
Polling inputs:
8884

8985
if GPIO.input("P8_14"):
9086
print("HIGH")
9187
else:
9288
print("LOW")
9389

94-
Waiting for an edge (GPIO.RISING, GPIO.FALLING, or GPIO.BOTH::
90+
Waiting for an edge (GPIO.RISING, GPIO.FALLING, or GPIO.BOTH:
9591

9692
GPIO.wait_for_edge(channel, GPIO.RISING)
9793

9894
or
9995

10096
GPIO.wait_for_edge(channel, GPIO.RISING, timeout)
10197

102-
Detecting events::
98+
Detecting events:
10399

104100
GPIO.add_event_detect("P9_12", GPIO.FALLING)
105101
#your amazing code here
106102
#detect wherever:
107103
if GPIO.event_detected("P9_12"):
108104
print "event detected!"
109105

110-
**PWM**::
106+
### PWM
107+
**The PWM Duty Cycle range was reversed in 0.0.15 from 100(off)-0(on) to 0(off)-100(on). Please update your code accordingly.**
111108

112109
import Adafruit_BBIO.PWM as PWM
113110
#PWM.start(channel, duty, freq=2000, polarity=0)
@@ -122,7 +119,7 @@ Detecting events::
122119
#set polarity to 1 on start:
123120
PWM.start("P9_14", 50, 2000, 1)
124121

125-
**ADC**::
122+
### ADC:
126123

127124
import Adafruit_BBIO.ADC as ADC
128125
ADC.setup()
@@ -133,23 +130,20 @@ Detecting events::
133130
#read_raw returns non-normalized value
134131
value = ADC.read_raw("P9_40")
135132

136-
**Running tests**
133+
## Running tests
137134

138-
Install py.test to run the tests. You'll also need the python compiler package for py.test.::
135+
Install py.test to run the tests. You'll also need the python compiler package for pytest:
139136

140-
opkg update && opkg install python-compiler
141-
#Either pip or easy_install
142137
pip install -U pytest
143-
easy_install -U pytest
144138

145-
Execute the following in the root of the project::
139+
Execute the following in the root of the project:
146140

147-
py.test
141+
pytest
148142

149-
**Credits**
143+
## Credits
150144

151145
The BeagleBone IO Python library was originally forked from the excellent MIT Licensed [RPi.GPIO](https://code.google.com/p/raspberry-gpio-python) library written by Ben Croston.
152146

153-
**License**
147+
## License
154148

155149
Written by Justin Cooper, Adafruit Industries. BeagleBone IO Python library is released under the MIT License.

0 commit comments

Comments
 (0)