GPIO Port 22 - Python Complains - Raspberry Pi Forums
hellos,
trying assign gpio ports use outputs. easy enough in
python , 8 work except 1 port. i'll post snip of code , results.
note: based gpio ports on http://elinux.org/rpi_low-level_peripherals
states 2, 3, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 27
available use... raspberrypi b+ rev2
python code:
import rpio
import time
def rxreadport():
index, bit in enumerate(rxbus):
rxdat[index]='0'
results=rpio.input(bit)
if results:
rxdat[index]='1'
def setgpiosmode():
print "receiver"
bit in rxbus:
print bit
rpio.setup(bit,rpio.in)
print "transmitter"
bit in txbus:
print bit
rpio.setup(bit,rpio.out)
# available gpio pins http://elinux.org/rpi_low-level_peripherals
# 2,3,4,7,8,9,10,11,14,15,17,18,22,(23),24,25,27
# initilization
rxbus=(14,2,3,4,15,18,27,17) # gpio mapping rx (lsb--msb)
txbus=(22,24,10,25,9, 11,7,8) # gpio mapping tx
rxdat=[0,0,0,0,0,0,0,0] # rx data bus initilization
txdat=[0,0,0,0,0,0,0,0] # tx data bus initilization
# set port modes rx , tx
setgpiosmode()
# cleanup
rpio.cleanup()
and here output:
receiver
14
2
3
4
15
18
27
17
transmitter
22
runtimewarning: channel in use, continuing anyway. .... rpio_setup(bit,rpio.out)
question: know why gpio-22 seems fail when attempt set output? there fix this?
in advance - george
trying assign gpio ports use outputs. easy enough in
python , 8 work except 1 port. i'll post snip of code , results.
note: based gpio ports on http://elinux.org/rpi_low-level_peripherals
states 2, 3, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 27
available use... raspberrypi b+ rev2
python code:
import rpio
import time
def rxreadport():
index, bit in enumerate(rxbus):
rxdat[index]='0'
results=rpio.input(bit)
if results:
rxdat[index]='1'
def setgpiosmode():
print "receiver"
bit in rxbus:
print bit
rpio.setup(bit,rpio.in)
print "transmitter"
bit in txbus:
print bit
rpio.setup(bit,rpio.out)
# available gpio pins http://elinux.org/rpi_low-level_peripherals
# 2,3,4,7,8,9,10,11,14,15,17,18,22,(23),24,25,27
# initilization
rxbus=(14,2,3,4,15,18,27,17) # gpio mapping rx (lsb--msb)
txbus=(22,24,10,25,9, 11,7,8) # gpio mapping tx
rxdat=[0,0,0,0,0,0,0,0] # rx data bus initilization
txdat=[0,0,0,0,0,0,0,0] # tx data bus initilization
# set port modes rx , tx
setgpiosmode()
# cleanup
rpio.cleanup()
and here output:
receiver
14
2
3
4
15
18
27
17
transmitter
22
runtimewarning: channel in use, continuing anyway. .... rpio_setup(bit,rpio.out)
question: know why gpio-22 seems fail when attempt set output? there fix this?
in advance - george
raspberrypi
Comments
Post a Comment