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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -