Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. #!/usr/bin/ python
  26.  
  27.  
  28. import time
  29. import serial
  30.  
  31.  
  32. ser = serial.Serial(
  33.  port='/dev/ttyUSB0',
  34.  baudrate = 9600,
  35.  parity=serial.PARITY_NONE,
  36.  stopbits=serial.STOPBITS_ONE,
  37.  bytesize=serial.EIGHTBITS,
  38.  timeout=None
  39. )
  40.  
  41.  
  42. while 1:
  43.  x=ser.readline().decode('utf-8')
  44.  with open('outputbarcode.txt', 'a+') as myfile:
  45.      myfile.write(x)
  46.  
  47.  
  48.  print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement