我是python的新手,我想知道如何获取来自另一个覆盆子pi发件人的二进制数据。我希望我的逻辑是正确的。如果您发现任何错误,请告诉我。请用正确的代码回答问题。谢谢。
这是我的代码:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(31, GPIO.IN)
a=[]
# here is the problem when i can't fetch all the binary data from the GPIO pin 31 which is a clock pin of raspberry pi b+ model
a=GPIO.read() # should receive binary data which is not happening
for i in range(len(a)):
print 'a'
if GPIO.input(31)==True:
a.append(1)
if GPIO.input(31)== False:
a.append(0)
print a #all binary data should be collected and be printed over here
GPIO.cleanup()