From 9dc83ca4776d8f557840d9f599c99a05dca304b3 Mon Sep 17 00:00:00 2001 From: Fisch Date: Sun, 13 Feb 2022 15:03:51 +0100 Subject: [PATCH] add python serial type test --- tools/serialtype.py | 31 ------------------------------ tools/test_keyboard.py | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 31 deletions(-) delete mode 100644 tools/serialtype.py create mode 100644 tools/test_keyboard.py diff --git a/tools/serialtype.py b/tools/serialtype.py deleted file mode 100644 index 40cf911..0000000 --- a/tools/serialtype.py +++ /dev/null @@ -1,31 +0,0 @@ -#! /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() diff --git a/tools/test_keyboard.py b/tools/test_keyboard.py new file mode 100644 index 0000000..218d108 --- /dev/null +++ b/tools/test_keyboard.py @@ -0,0 +1,43 @@ +#! /usr/bin/env python3 +import serial + +chars=" qwertzuiopü+asdfghjklöä#yxcvbnm,.-QWERTZUIOPÜ*ASDFGHJKLÖÄ'YXCVBNM;:_1234567890ß!\"§$%&/()=?" + +def main(): + with serial.Serial('/dev/ttyUSB0', 9200, timeout=1) as ser: + + print("ZWÖLF BOXKÄMPFER JAGEN VIKTOR QUER ÜBER DEN GROßEN SYLTER DEICH.") + print("zwölf boxkämpfer jagen viktor quer über den großen sylter deich.") + print("+#,.-*';:_1234567890!\"§$%&/()=?") + print("") + + + ser.write("ZWÖLF BOXKÄMPFER JAGEN VIKTOR QUER ÜBER DEN GROßEN SYLTER DEICH.".encode()) + ser.write(b'\r\n') + ser.write("zwölf boxkämpfer jagen viktor quer über den großen sylter deich.".encode()) + ser.write(b'\r\n') + ser.write("+#,.-*';:_1234567890!\"§$%&/()=?".encode()) + + ser.write(b'\r\n') + ser.write(b'\r\n') + + + print("Zeile1, rn") + print("Zeile2, n") + print("Zeile4 Zeile3, r") + + ser.write(b'Zeile1, rn') + ser.write(b'\r\n') + ser.write(b'Zeile2, n') + ser.write(b'\n') + ser.write(b'Zeile3, r') + ser.write(b'\r') + ser.write(b'Zeile4') + ser.write(b'\r\n') + + + + + +if __name__ == "__main__": + main()