19 lines
419 B
Python
Executable file
19 lines
419 B
Python
Executable file
#!/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])
|