Simple python script for serial plotters

... use it
#!/usr/bin/python3

import sys
import serial

if __name__ == "__main__":
    file = sys.argv[1]
    with open(file, 'r') as content_file:
        content = content_file.read()
        ser = serial.Serial('/dev/ttyUSB0', 9600, bytesize=8, parity='N', stopbits=serial.STOPBITS_TWO,
                        timeout=5, xonxoff=False, rtscts=True)
    ser.write(content.encode())
    ser.flush()
    ser.close()

Criado/Created: 06-09-2025 [15:06]

Última actualização/Last updated: 06-09-2025 [15:20]


Back...


For attribution, please cite this page as:

Charters, T., "Simple python script for serial plotters": https://blog.nexp.pt/plt.html (06-09-2025 [15:20])


(cc-by-sa) Tiago Charters - tiagocharters@nexp.pt