read_serial.py 326 B

123456789101112131415161718
  1. #!/usr/bin/env python
  2. import time
  3. import serial
  4. ser = serial.Serial(
  5. port='/dev/ttyACM2',
  6. baudrate = 9600,
  7. parity=serial.PARITY_NONE,
  8. stopbits=serial.STOPBITS_ONE,
  9. bytesize=serial.EIGHTBITS,
  10. timeout=1)
  11. counter=0
  12. while 1:
  13. x=ser.readline()
  14. print x