nrf24l01 arduino to raspberry pi struct code example
Example: nrf24l01 arduino to raspberry pi struct
while True:
while not radio.available(0):
## print("Nepareina")
time.sleep(1)
# wrong: duomenys = []
# right:
nbBytesData = 8 # nbBytesData is the expected size of the incoming array in bytes
duomenys = bytearray(nbBytesData)
radio.read(duomenys, radio.getDynamicPayloadSize())
data = struct.unpack('ff',duomenys)
rollx = data [0]
pitchy = data[1]
print(rollx)
print(" ")
print(pitchy)