Python, no definition to call serial.close() to close the serial port.
Python, no definition to call serial.close() to close the serial port.
I read through all the code and documentation of called modules, like serial, and I don't see any definition for a call to "serial.close()'!
I see at the end of "roboclaw.py" a call to open:
Shouldn't there be a seperate definition for the code to call:
as well as a call to ensure all motors are stopped before the call to close()?
Luckily I was able to re-run the program again and issue a motor stop command before killing the test app. I thought it might be automatic upon loss of serial communications but that doesn't seem to be the case.
I see at the end of "roboclaw.py" a call to open:
Code: Select all
def Open(self):
try:
self._port = serial.Serial(port=self.comport, baudrate=self.rate, timeout=1, interCharTimeout=self.timeout)
except:
return 0
return 1
Code: Select all
self._port.close()
Luckily I was able to re-run the program again and issue a motor stop command before killing the test app. I thought it might be automatic upon loss of serial communications but that doesn't seem to be the case.
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: Python, no definition to call serial.close() to close the serial port.
You need to install pyserial to use our class. Serial is part of the pyserial class.