Gopigo3 How to use serial port?

Has anyone used the serial port on the gopigo3 to drive serial 9600 communications to a device (LCD, GPS). I’ve not been able to initialize and write to the serial port in a python script. Here’s the code I’ve cut and pasted together to diagnose …

You’ll see I turn on the left eye (Green) and then would turn it off if it ever got past the write to the serial port … eye goes green never goes off, if I kill the script I see i’ve been waiting for ser.write to complete


GPG = gopigo3.GoPiGo3() # Create an instance of the GoPiGo3 class. GPG will be the GoPiGo3 object.

GPG.set_led(GPG.LED_WIFI, 0, 0, 0) # Turn off wifi led to signal running
port = ‘/dev/ttyAMA0’
baud = 9600
timeout = 2
ser = serial.Serial(port,baud,timeout=timeout)
ser.flush()
rospy.sleep(0.5)
cmd1 = “sc;”
cmd2 = “ssHello;”
GPG.set_led(GPG.LED_EYE_RIGHT, 0, 1, 0) # Turn off wifi led to signal running
ser.write(cmd1)
rospy.sleep(0.5)
ser.write(cmd2)
rospy.sleep(0.5)
GPG.set_led(GPG.LED_EYE_RIGHT, 0, 0, 0) # Turn off wifi led to signal running

any thoughts?

Solved my own issue. The port is really /dev/ttyS0
Much searching of the web but finaly found it …

1 Like

This article might also help you:
http://hallard.me/enable-serial-port-on-raspberry-pi/

The old serial for the hardware serial is paired with /dev/ttyS0 whereas the hardware one is now attached to the bluetooth module. You might want to switch those 2.