I am doing a project where we want to use a raspberry pi to communicate with a motor controller using a usb connection. The motor controller already has this functionality, I am just having trouble getting it to work. I am posting here and on the manufacturers website in hopes to find the issue. Below is the code I am trying to send via usb to the motor controller. I am asking for the motor controllers device ID and expecting it to reply after I send it. If there are any errors in my code or how I am going about this, I would greatly appreciate any help you can provide.
Code: Select all
import serial import time ser = serial.Serial('/dev/ttyACM0', 115200, bytesize = serial.EIGHTBITS, parity = serial.PARITY_NONE, stopbits=Serial.STOPBITS_ONE, wiriteTimeout = 0, rtscts = False, dsrdtr=False,xonxoff=False, timeout = 10) time.sleep(2) command = '?FID' ser.write(bytes(command.encode('ascii'))) s= ser.readline print str(s)