-
Notifications
You must be signed in to change notification settings - Fork 0
/
KERNpython3.py
35 lines (25 loc) · 1.09 KB
/
KERNpython3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# This program shows how to read Omega HH506RA thermocouple meter T1 and T2 with Python 2.6
#####################################################################################
# REQUIREMENTS
# python 3.x: http://www.python.org/ftp/python/
# pyserial for python 2.6: http://sourceforge.net/projects/pyserial/files/pyserial/2.6/
# javacomm: http://www.xpl4java.org/xPL4Java/javacomm.html
# Java JDK or JRE: http://java.sun.com/javase/downloads/index.jsp
import serial
import time
def main():
print("use CTRL + C to interrupt program\n")
delay = 3 # set interval of seconds between each reading
port = '/dev/cu.usbserial-FTFKDA5O'
ser = serial.Serial(port, baudrate=19200, bytesize=8, parity='N', stopbits=1, timeout=1)
while True:
#v = fl.readlines(eol=serial.to_bytes("\r\n"))
#v = ser.read()
ser.write(b"s") # only stable
#ser.write(b"w") # any weight
v = ser.readline()
# b' 194 g \r\n'
print(v)
time.sleep(delay)
main()