add python serial write script

This commit is contained in:
interfisch 2022-02-13 13:00:19 +01:00
parent 5286466d2c
commit d0f82299c0
1 changed files with 31 additions and 0 deletions

31
tools/serialtype.py Normal file
View File

@ -0,0 +1,31 @@
#! /usr/bin/env python3
import serial
#chars=" qwertzuiopü+asdfghjklöä#yxcvbnm,.-QWERTZUIOPÜ*ASDFGHJKLÖÄ'YXCVBNM;:_1234567890ß!\"§$%&/()=?"
chars=" qwertzuiop+asdfghjklöä#yxcvbnm,.-QWERTZUIOP*ASDFGHJKLÖÄ'YXCVBNM;:_1234567890ß!\"§$%&/()=?"
#asciiresolution_max=[97,65] #maximum, in characters xy. Teilung=15
#asciiresolution_max=[78,65] #maximum, in characters xy. Teilung=12
asciiresolution_max=[65,30] #maximum, in characters xy. Teilung=10
def main():
import sys
if len(sys.argv) != 2:
print("Usage: serialtype filename")
sys.exit(1)
filename=sys.argv[1]
with serial.Serial('/dev/ttyUSB0', 9200, timeout=1) as ser:
ser.write(b'test')
ser.write(b'\n')
ser.write(b'zeile2')
if __name__ == "__main__":
main()