I follow relay's command set "@00 RS 0" to get returns status of all relays.In arduino serial monitor tool,I send the command and manage to get proper reply message eg: #01 1.
In my python project,I expect write command of "@00 RS 0" to serial port of relays should return same message. However,it doesn't.
I execute the method ConnectFunc() 3 times,get return difference message as follow.I'm lose with the message.What suppose to do to make it reply message same as arduino serial monitor.
('read data', '011617292515111916\r#0 98 0 019 918 1\r\n')
('read data', '1 9183171715\r#0 8 7 51113191815#0119181611 8 1 787\r#0 617151113191815\n')
('read data', ' 1 151871 8219\n')
def ConnectFunc(self):
print("Connect function")
global Arduino
global DeviceAddress
try:
Arduino = serial.Serial(self.PortNumberEntry.get(), self.BaudOptionVar.get(), timeout=.1)
#tkMessageBox.showinfo("Arduino COnnection", "Successfully connected")
DeviceAddress = self.AddressEntry.get()
print('Device address: %s' % DeviceAddress)
global thread
thread = SerialThread(self.queue)
print('Starting thread')
thread.start()
Arduino.write("@00 RS 0\r")
time.sleep(6)
data = Arduino.readline()
print("read data",data)
except SerialException:
Arduino.close()
#tkMessageBox.showerror("Error", " Erorr in opening port")
#return
Thank your advice