📜  nrf24l01 arduino 到树莓派结构 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:55.826000             🧑  作者: Mango

代码示例1
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)