Skip to content

Commit

Permalink
Python tool to receive data through uart
Browse files Browse the repository at this point in the history
  • Loading branch information
wpmed92 committed Jan 2, 2023
1 parent db0bc09 commit 99a080b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tools/listen2d2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import serial

with serial.Serial("/dev/tty.usbserial-210319B4A2F21", baudrate=9600, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS, timeout=1000) as ser:
s = ser.read(1)
out = ""

while (True):
out += s.decode("utf-8")
if (s == b'\n'):
print(out)
out = ""

s = ser.read(1)

0 comments on commit 99a080b

Please sign in to comment.