Skip to content

Update UART examples #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Adafruit_BBIO/sysfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# Print all block devices in /sys, with their sizes
for block_dev in sys.block:
print block_dev, str(int(block_dev.size) / 1048576) + ' M'
print(block_dev, str(int(block_dev.size) / 1048576) + ' M')

>>> import sysfs
>>> # Read/write Beaglebone Black's eQEP module attributes
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Detecting events:
#your amazing code here
#detect wherever:
if GPIO.event_detected("P9_12"):
print "event detected!"
print("event detected!")

### PWM
**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.**
Expand Down Expand Up @@ -198,13 +198,10 @@ import serial

UART.setup("UART1")

ser = serial.Serial(port = "/dev/ttyO1", baudrate=9600)
ser.close()
ser.open()
if ser.isOpen():
print "Serial is open!"
ser.write("Hello World!")
ser.close()
with serial.Serial(port = "/dev/ttyO1", baudrate=9600) as ser:
print("Serial is open!")
ser.write(b"Hello World!")

```
* Available UART names on BeagleBone
* `UART1`: /dev/ttyO1, Rx: P9_26, Tx: P9_24
Expand Down
10 changes: 3 additions & 7 deletions docs/UART.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ Example::

UART.setup("UART1")

ser = serial.Serial(port = "/dev/ttyO1", baudrate=9600)
ser.close()
ser.open()
if ser.isOpen():
print "Serial is open!"
ser.write("Hello World!")
ser.close()
with serial.Serial(port = "/dev/ttyO1", baudrate=9600) as ser:
print("Serial is open!")
ser.write(b"Hello World!")

.. module:: Adafruit_BBIO.UART

Expand Down
2 changes: 1 addition & 1 deletion source/examples/python/i2ctmp101.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

while True:
temp = bus.read_byte_data(address, 0)
print (temp, end="\r")
print(temp, end="\r")
time.sleep(0.25)
2 changes: 1 addition & 1 deletion test/notes/spi_loopback_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ from Adafruit_BBIO.SPI import SPI
#spi = SPI(1,1) #/dev/spidev2.1

spi = SPI(0,0)
print spi.xfer2([32, 11, 110, 22, 220])
print(spi.xfer2([32, 11, 110, 22, 220]))
spi.close()
```

Expand Down
2 changes: 1 addition & 1 deletion test/start_all_pwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# /sys/devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip5/pwm-5:0/duty_cycle

for pin in pins:
print pin
print(pin)
PWM.start(pin, 50, 2000, 1)
PWM.stop(pin)
PWM.cleanup()
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy