cammiechat/pyserial.py

11 lines
198 B
Python
Raw Normal View History

2024-09-26 20:52:45 +02:00
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()