SHARE
TWEET

Untitled

a guest Jun 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. import time
  3. import serial
  4.  
  5. ser = serial.Serial(  
  6.    port='/dev/ttyAMA0',
  7.    baudrate = 4800,
  8.    parity=serial.PARITY_NONE,
  9.    stopbits=serial.STOPBITS_ONE,
  10.    bytesize=serial.EIGHTBITS,
  11.    timeout=1
  12. )
  13. ser.write(serial.to_bytes([0x33]))  # try to_bytes
  14. time.sleep(2)
  15. ser.write(b'0x33')                  # try b'
  16. time.sleep(2)
  17. ser.write(b'0x33')
  18. time.sleep(4)
  19. ser.write(b'0x33')
  20. time.sleep(4)
  21. ser.write(b'0x33')
  22. time.sleep(0.4)
  23. ser.write(b'0x33')
  24. time.sleep(0.4)
  25.  
  26. ser.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top