Menu

Topic-icon Writeing a program in python to control Pyserial, Pygame

More
5 months 2 weeks ago - 5 months 2 weeks ago #29534647 by Depps
Hey i am writing a python script to be able to controll a motor controller i am using pyserial to open a serial port and pygame for controller input. I am trying to use port.write(!G 1 500 /r/n) command and then i read from it but it is not working i dont get any action from the motors do i need to use a diffent command for it work

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #29534658 by blake
It looks like you have the carriage return incorrect, it should be !G 1 500\r (no space between carriage return and command string, no \n necessary).

Additionally keep in mind that by default we have a serial watchdog time enabled for 1000ms. Unless your script is looping at less than 1s, this command would execute but the motor would only move for 1s and then stop. You will either need to disable or extend the watchdog timer in the controller configuration.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.087 seconds
Go to top