Guest User

Untitled

a guest
Nov 19th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import serial
  2.  
  3. ###################
  4. # PRIVATE CLASSES #
  5. ###################
  6.  
  7. # wait acknowledgment for data reception
  8. def wait_ack(self):
  9. s = self.serialVM.read(1)
  10. if len(s) > 0:
  11. s = int.from_bytes(s, byteorder='little', signed=False)
  12. self.status = 1
  13. return(s)
  14. return -1
  15.  
  16. def check_selection(self):
  17. self.serialVM.flushInput()
  18. self.serialVM.write(bytearray.fromhex("32"))
  19. req = self.wait_ack() #THIS SHOULD RETURN THE DECIMAL VALUE BUT RETURNS WRONG DECIMALS
  20. if (req != 254) and (req != 0):
  21. return req
  22. else:
  23. return False
Advertisement
Add Comment
Please, Sign In to add comment