![]() ![]() If the script executes successfully against an awake (ideally with Ignition On) GO device, the output should resemble: read ( 6 ) print () if len ( readback ) = 6 and readback = 2 : print ( "data ACK received" ) Else : print ( "invalid response" ) write ( dataMessage ) print ( "waiting for data ACK." ) readback = tester. StatusDataID = 35349 #status data id of "Test engine measurement / fake data"ĭataValue = 200 #data value of 10 will show on MyGeotab (because of the conversion factor of 0.1 and offset of -10)ĭataMessage = createMessage ( bytes ()) print ( "sending status data" ) print () tester. HandshakeResponse = createMessage ( bytes ()) print ( "sending handshake response" ) print () tester. ![]() read ( 6 ) print () if len ( readback ) = 6 and readback = 1 : print ( "handshake request received" ) #send the handshake responseĭeviceID = 4208 #4208 is a test Device ID write ( bytes ()) print ( "waiting for handshake request." ) readback = tester. Print ( "sending sync char" ) print ( "" ) tester. # with serial.Serial(port="COM4", baudrate = 9600, timeout = 10) as tester: # with serial.Serial(port="/dev/ttyUSB0", baudrate = 9600, timeout=1) as tester: Import serial import time def checksum ( message ): b0 = 0 b1 = 0 for i in range ( 0, len ( message )): b0 = int ( message ) b1 = b0 return bytes () def createMessage ( message ): message = bytes () message check = checksum ( message ) message = message check bytes () return message # look for ttyUSB in Linux (ls /dev/tty\*) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |