Hello,
I have made a serial script and its working with the Cytron Smart Drive Duo 60 motor controller
Here it is :
- CODE: SELECT_ALL_CODE
import webiopi
from webiopi.devices.serial import Serial
from time import sleep
serial = Serial('ttyUSB0', 9600) #enter correct port for serial
# write data to serial port
def motor_on_off():
user_input = input("\n Type Fwd / Rev / Stop :")
if user_input == "Fwd": #Running motor at full speed in forward direction
print("M1 Fwd")
sleep(6)
serial.writeString("63")
motor_on_off()
elif user_input == "Rev": #Running motor at full speed in reverse direction
print("M1 Rev")
sleep(6)
serial.writeString("127")
motor_on_off()
elif user_input == "Stop" or user_input == "s":
print("M1 Stop")
sleep(6)
serial.writeString("0")
serial.close()
else:
print("Invalid Input. Type Fwd / Rev / Stop. ")
motor_on_off()
sleep(2) #Wait for serial connection to initialize
motor_on_off()
But the problem is that even when the script is executed, the motor doesn't stop even after closing the serial port i.e. serial.close()
Can you let me know any possible solution for it?