Lastnight I downloaded the Python driver and some Linux specific software for my CF635 display. It all worked fine lastnight. Today I changed out the LCD because the old one would lock up. Now I'm getting an error from Python when I start up the test script.
For some reason ser.read() isn't receiving anything. I tested with the other Linux software and the display is working properly. It has something to do with this Python implementation not being able to read a character from the tty.
Like I said, the only thing that I've done is install a new LCD module, and I've tested it in both Windows and Linux and it's working fine, except for this Python implementation. And it was working fine before that. Any ideas?
Here's part of SendCommand(), up to the error point.
Code:
[starlon@localhost cf]$ python 635Test.py
Traceback (most recent call last):
File "635Test.py", line 51, in <module>
if not hello.Connect('/dev/ttyUSB0'): print "Failed to connect!"
File "/home/starlon/Download/cf/pyCF635Driver.py", line 80, in Connect
if (self.Ping("Test") != "Test"):
File "/home/starlon/Download/cf/pyCF635Driver.py", line 174, in Ping
return self.SendCommand(0,msg)
File "/home/starlon/Download/cf/pyCF635Driver.py", line 262, in SendCommand
cmdResponse = ord(self.ser.read(1)) # Read the command response
TypeError: ord() expected a character, but string of length 0 found
Like I said, the only thing that I've done is install a new LCD module, and I've tested it in both Windows and Linux and it's working fine, except for this Python implementation. And it was working fine before that. Any ideas?
Here's part of SendCommand(), up to the error point.
Code:
def SendCommand ( self, command, data ):
"""GetCRC (buffer) - Finds the CRC checksum buffer. SRC: CrystalFontz"""
if self.ser == None: return "Error: Not connected!" # Check for a connection
output = '%c%c%s' % (chr(command), chr(len(data)), data ) # Parse the command
CRCValue = self.getCRC(output) # Get the CRC Value
output = "%s%c%c" % (output, chr(CRCValue & 0xFF), chr((CRCValue>>8)&0xFF) ) # Add the CRC value
self.ser.flushOutput() # Flush the output
self.ser.flushInput() # Flush the input
self.ser.write(output) # Send the command
cmdResponse = ord(self.ser.read(1)) # Read the command response
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.