cammiechat/pyserial.py
2024-09-26 20:52:45 +02:00

10 lines
198 B
Python

import serial
import requests
ser = serial.Serial('/dev/ttyUSB0')
while True:
line = ser.readline()
out = requests.post("http://localhost:3000/reply",data=line.decode()[:-1])
ser.close()