add python serial type test

This commit is contained in:
interfisch 2022-02-13 15:03:51 +01:00
parent f217cf7388
commit 9dc83ca477
2 changed files with 43 additions and 31 deletions

View File

@ -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()

43
tools/test_keyboard.py Normal file
View File

@ -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()