brotherax_teletype/tools/serialtype.py

32 lines
794 B
Python

#! /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()