Python, no definition to call serial.close() to close the serial port.

General discussion of using Roboclaw motor controllers
Post Reply
JorgeP
Posts: 14
Joined: Thu Nov 16, 2017 8:16 am
Python, no definition to call serial.close() to close the serial port.

Post by JorgeP »

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:

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
Shouldn't there be a seperate definition for the code to call:

Code: Select all

	self._port.close()
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.
User avatar
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.

Post by Basicmicro Support »

You need to install pyserial to use our class. Serial is part of the pyserial class.

Post Reply