Unfortunately, in order to find the correct serial port on a Pi you need to be able to find the correct serial port on a Pi.The error message is telling you you're trying to open a serial port that doesn't exist. Find the actual serial port and change the port parameter in serial.Serial()
now I have this Error
photo_2024-03-25_23-58-07.jpg
and here my code
import serial
import time
# Настройки соединения с модулем
ser = serial.Serial(
port='/dev/ttyAMA0', # Подключение к порту ttyAMA0
baudrate=256000, # Скорость передачи данных
bytesize=serial.EIGHTBITS, # Размер байта
parity=serial.PARITY_NONE, # Без проверки паритета
stopbits=serial.STOPBITS_ONE, # Один стоп-бит
)
# Чтение данных
while True:
if ser.in_waiting:
data = ser.read(ser.in_waiting)
print(data.decode('utf-8')) # Декодирование и печать данных
time.sleep(0.1) # Краткая пауза перед следующим чтением
Can someone guide me on how to verify the serial port to which my HLK-LD2450 module is connected on a Raspberry Pi? I have tried using the device '/dev/ttyAMA0' in my Python script, but I am receiving 'No such file or directory' errors. I suspect the device might be listed under a different name. Is there a reliable method or command I can use to identify the correct serial port for my module?
viewtopic.php?t=324412
Statistics: Posted by ame — Wed Mar 27, 2024 4:53 am