问题描述
我正在尝试连接Arduino(带有4.0蓝牙模块)和RaspBerry pi 4(带有蓝牙模块)。 我只希望Rasp接收字符串而不发送,所以arduino草图:
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(2,3);
void setup() {
bluetooth.begin(9600);
}
void loop() {
delay(500);
bluetooth.println("string");
}
现在,如果我尝试将智能手机与蓝牙终端连接,则可以正常工作,但是当我尝试在RaspBerry上进行相同操作时,它不会收到任何字节。 这是我尝试过的:
import serial
bluetoothSerial = serial.Serial("/dev/rfcomm0",baudrate=9600)
print(bluetoothSerial.readline())
bluetoothSerial.close()
尽管两个设备已配对并连接,但几秒钟什么都没收到后,却给我一个错误,提示"The Host is down"
。
这些是bluetoothctl的屏幕截图
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)