client232/send.py

20 lines
419 B
Python
Raw Permalink Normal View History

2018-11-27 09:20:00 +00:00
#!/usr/bin/env python3
import time
import serial
import sys
def sendMessage(code):
with serial.Serial(
port='/dev/ttyAMA0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
) as s:
s.write(code + "\r")
if __name__ == "__main__":
sendMessage(sys.argv[1])