python - Serial received data not recognised -
i connecting pic raspberry pi through serial port. max485 transmit , receive enable pin controlled gpio pin. received data printed successfully. not performing desired function.
while true: gpio.output(repin, false) port.flushinput() time.sleep(.oo5) port.write(bytes(address)) time.sleep(.01) gpio.output(repin, ture) port.flushinput() data=port.readline() if data: address=address+1 if data == "ok" : print "reached" print data if not data: print "no data"
when receiving ok. prints "ok" didn't print "reached". , when data not received printing blank value instead of "no data".
there nothing wrong in code. if write pic program correctly problem coming proper termination resistors of max485.connect twisted pair cable ground proper resistance.
Comments
Post a Comment