Go Down

Topic: Problem with Putty (Read 24035 times) previous topic - next topic

trol188

Hello,
This is how to solve the problem reading serial data with the APC220 from python :

import serial # pyserial 2.7

ser = serial.Serial()
ser.port = "COM5"
#ser.port = "/dev/ttyS2"
ser.baudrate = 9600
ser.bytesize = serial.EIGHTBITS #number of bits per bytes
ser.parity = serial.PARITY_NONE #set parity check: no parity
ser.stopbits = serial.STOPBITS_ONE #number of stop bits
ser.timeout = 0             #non-block read
ser.xonxoff = False     #disable software flow control
ser.rtscts = False     #disable hardware (RTS/CTS) flow control
ser.dsrdtr = False       #disable hardware (DSR/DTR) flow control

ser.setRTS(0)  #  <---- THIS SOLVED THE PROBLEM READING SERIAL DATA WITH APC220

ser.open()     
while 1:
  time.sleep(1)
  linea = str(ser.read(ser.inWaiting()))
  print("." + linea )
ser.close()

Go Up