HC-05

March 27, 2024, 14:02

1248163264.

Hi, I'm having an issue with communication between two HC-05 modules. One module is set as the master to send data from a Raspberry Pi Pico, to which a joystick is connected. The data is sent via Bluetooth and received by the second HC-05 module set as a slave, connected to a Raspberry Pi 4. After a few seconds, I encounter this error. What could it be? How can I resolve it?video

k9t33n

Text as text please

k9t33n

So post the python code and error

1248163264.

python
import serial
import time
import termios


uart_channel = serial.Serial('/dev/ttyS0', 9600, timeout=0.25)

def main():
    data = uart_channel.read(16)
    print(data)

while True:
    try:
        main()
    except (serial.SerialException, termios.error) as e:
        print(f"SerialException: {e}")
        break
        time.sleep(1)  
    finally:
        try:
            uart_channel.flushInput()  
        except termios.error as e:
            print(f"Termios error: {e}")

1248163264.

 
SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Termios error: (5, 'Input/output error')

oops.se

Have you enabled the serial port with raspi-config or added it to /boot/cmdline.txt ?

1248163264.

Thanks, I added console=ttyS0,9600 to the /boot/cmdline.txt file and it works 😎