19 lines
419 B
Python
19 lines
419 B
Python
from time import sleep
|
|
|
|
import serial
|
|
|
|
INPUT_PORT = '/dev/ttyUSB0'
|
|
OUTPUT_PORT = '/dev/ttyUSB0'
|
|
|
|
serialInput = serial.Serial(INPUT_PORT, 115200, timeout=1)
|
|
serialOutput = serial.Serial(OUTPUT_PORT, 115200, timeout=1)
|
|
|
|
def lees():
|
|
while True:
|
|
line = serialInput.readline()
|
|
print(line)
|
|
|
|
def verzend(telegram):
|
|
serialOutput.write(telegram.__str__().encode('ascii'))
|
|
print(telegram)
|
|
sleep(1) |