I have a stepper motor controller that I can command through a USB COM on windows. The manufacturer provided a software but I want to create my own on python (In fact, I want to include the control of the stepper into a python code that control another device using the stepper). The problem is that I don't have any information about the commands to send to the controller to move the motor. I want to know if there is a way to read the command sent to the controller using the manufacturer software (like move the motor and read the command sent) and then use that command to write my own code on python ? I want to know if my idea is pure fantasy or if this can actually be done ? Thanks
I was able to solve my problem by reverse engineering the protocol of the device :
import time
import usb.core
import usb.util
from sys import exit
import sys
'''
On windows : Install libusb-win32
Install zadig
Launch Zadig :
choose the driver
choose libusb-win32
choose "install filter driver"
restart the computer
'''
VID = 0x04d8
PID = 0x000a
dev = usb.core.find(idVendor=VID, idProduct=PID)
if not dev:
print("Could not find device ")
exit(1)
else:
print("Yeeha! Found the device")
dev.set_configuration()
# command : Limit
dev.write(2, (0x59, 0x4c, 0x0d))