raspberry pi - Raspberrypi Python bus.read_byte -


is there python function respond wire.available function in arduino data on wire rather having specify how many bytes grab?

this have now, , works fine, have know how data coming down wire, or provide unexpected results.

for in range(0, 13):  data += chr(bus.read_byte(address)); 

thanks!

not perfect solution, found way around knowing how many bytes on way.

on arduino, specified max size of buffer, (128), add data, 0 out rest, , send whole thing. on pi, receive whole buffer, , first thing happens filter \x00 characters. it's not perfect, works now.

for in range(0, 128):     data += chr(bus.read_byte(address))  print repr(data)      #prints whole string received  data = filter(lambda a: != '\x00')  print repr(data)     #prints string without '\x00' characters. 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -