serial rs485 - 자하수 센서 데이타 읽어오기
페이지 정보

본문
import logging, sys, time
import serial
ser = serial.Serial("COM4", baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1)
print("ser ==>", ser)
op = "0RtTSVIB!"
print("op=>", op)
while True:
try:
#ser.write(bytes(bytearray([3])))
ser.write(op.encode())
read_data = ser.readline()
print("read_data => ", str(read_data))
except Exception as e:
print(" error => ", e)
exit()
time.sleep(1)
ser.close()
- 이전글rs485 - 지하수 센서 데이타 읽은 후, 파일에 데이타 저장하기 - 1 22.11.23
- 다음글모드버스 관련 21.07.22
댓글목록
등록된 댓글이 없습니다.