Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import ctypes
- import serial
- import sys
- from binascii import hexlify
- ser = serial.Serial(
- port='/dev/ttyS0',
- baudrate=9600,
- parity=serial.PARITY_NONE,
- stopbits=serial.STOPBITS_ONE,
- bytesize=serial.EIGHTBITS,
- timeout=1,
- dsrdtr=False
- )
- counter = 0
- if (ser.isOpen() == False):
- ser.open()
- #Flush before receiving or sending any data
- ser.flushInput()
- ser.flushOutput()
- while 1:
- x = ser.read()
- print (hexlify(x))
- time.sleep(0.3)
Advertisement
Add Comment
Please, Sign In to add comment