top of page

Hardware

Public·105 members

BiBoard Serial Port

Has anyone connected a raspberry pi to the BiBoard using the Tx,Rx, Ground, and 5v GPIO pins? I was able to run ardserial.py using the usb-c port connected to the Rpi, but didn't have any luck with GPIO.

221 Views

For the second serial port, should it be sending a response after receiving a command? I've made a simple test in the main script of SerialCommunication.py in the serialMaster directory of opencat:


if __name__ == '__main__':

Communication.Print_Used_Com()

port = port_list_number

if not port:

print("No serial ports found.")

else:

myCom = Communication(port[0], 115200, 1)

print("Ret = ", Ret)

myCom.Open_Engine()


try:

while True:

key = input("Enter a command (or 'exit' to quit): ")

if key == 'exit':

print("Exiting...")

break


# Send the user input to the serial device

myCom.Send_data((key + '\n').encode('utf-8'))

print(f"Sent: {key}")


# Wait for a response from the serial device

response = ""

while True:

try:

line = myCom.Read_Line().decode('ISO-8859-1').strip()

if line:

response += line

# Check for known response endings

if response.endswith("k"):

break

else:

break

except UnicodeDecodeError as e:

print(f"Decode error: {e}")

break


# Extract the actual response before the "k"

actual_response = response[:-1].strip() if response.endswith("k") else response


if actual_response:

print(f"Received: {actual_response}")

else:

print("No response received")


except KeyboardInterrupt:

print("\nProgram interrupted by user.")

finally:

myCom.Close_Engine()


But this only sends a response back when I connect my raspberry pi to the BiBoard through USB instead of the tx2 and rx2 pins.


I'm trying to get confirmation that a command is executed on the BiBoard, so I don't need to blindly blast the board with a bunch of commands in my autonomous control loop.



About

Learn and extend Nybble's functionalities with customized de...

Members

bottom of page