Hi
I'm having some problems making Python talk to a hardware display using pyserial. Some of the display's functions require Signed Word to be sent as arguments after commands (ie. X or Y on display screen).
I've been getting by with chr() previously, but that only works with numbers < 255.
I've tried the following for conversion but it's giving some wierd results, placing things way off the set position:
def ByteIt(self,data):
datastring = str()
for each in tuple(str(data)):
datastring = datastring + chr(int(each))
return datastring
I may be way off myself here :)
Example of how i would use it:
x = 100
y = 350
serial.Write('\x01' + ByteIt(x) + ByteIt(y)) # command , xpos , ypos
The thing is, when i do this, the stuff is not placed at x100,y350, most times the display will crash :(
Any tips on how this can be done properly?