带外部蓝牙数据的raspberry pi3接收问题

时间:2017-01-23 12:03:41

标签: android python-2.7 bluetooth raspberry-pi3

我开发了通过蓝牙发送数据的Android应用程序。我使用覆盆子接收数据。我已将HC05蓝牙模块连接到覆盆子pi3 GPIO引脚(UART0 Tx,UART0r Rx,3.3v PWR,GND)。我编写了Python代码来显示数据。但是经过一段时间后(收到一些数据后)python显示以下错误:

 File "usr/lib/python2.7/dist-packages/serial/serialposix.py" line 460 in read
    raise SerialException('device reports readiness to read but returned no data(device disconnected?)')
    serial.serialutil.SerialException:device reports readiness to read but returned no data(device disconnected ?) 

并与HC05断开连接然后如果我尝试发送它的显示错误

File "usr/lib/python2.7/dist-packages/serial/serialposix.py" line 453 in read 
buf=os.read(self.fd,size-len(read))
 OSError:[Error no 11]Resource Temporarily unavaliable

请有人帮我解决这个问题。

My python code is as below:
import serial
import time

port=serial.Serial("/dev/ttyS0",baudrate=9600)

while True:
        rcv = port.read(2)
        print str(rcv)

0 个答案:

没有答案