File indexing completed on 2024-04-28 15:14:08

0001 #!/usr/bin/python
0002 
0003 import psutil, serial, time
0004 from subprocess import Popen
0005 
0006 Popen(["socat", "-d", "-d", "PTY,raw,echo=0,link=./serial_in", "PTY,raw,echo=0,link=./serial_out"])
0007 time.sleep(1)
0008 
0009 # rtscts=True,dsrdtr=True
0010 s = serial.Serial("./serial_in", 9600)
0011 print(s)
0012 
0013 while True:
0014   cpu_percent = str(psutil.cpu_percent(interval=2.))
0015   s.write(cpu_percent)
0016   print 'written ' + cpu_percent