Pyserial 无法从 macos 发送数据

Pyserial cannot send data from macos

提问人:ccla 提问时间:11/17/2023 更新时间:11/17/2023 访问量:7

问:

我无法通过蓝牙向蓝牙模块 HC-05 发送数据。我的朋友也使用macos,也无法发送数据。

import serial
from time import sleep

AR = serial.Serial('/dev/cu.xxxx', 115200)

if not AR.isOpen():
    AR.open()

try:
    while True:
        print('2')
        AR.write(b'BBRR\n')
        sleep(0.5)

except KeyboardInterrupt:
    AR.close()

我通过蓝牙发送数据,并通过USB端口监控使用coolterm接收的数据。 当我运行代码时,它进入循环,因为它连续打印 2 没有错误,但在 coolterm 中没有收到任何数据。
使用的端口是使用 和 找到的。尝试了找到的所有可用端口,但没有一个有效。
还尝试通过蓝牙端口通过USB和显示器发送数据,但仍然不起作用。
为什么它没有发送?
serial.tools.list_ports.comports()ls -l /dev.cu/*ls -l /dev.tty/*

macOS PySerial UART

评论


答: 暂无答案