我正在开发一个新项目,并且我已经使用以下https://github.com/nRF24/RF24库使用NRF24L01模块将arduino的数据发送到树莓派:
当我使用printDetails()函数时,一切似乎都很好,但是我无法在树莓派上接收数据。 有人可以帮我吗
非常感谢您!
Arduino代码:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(7,8);
const uint64_t address[1] = { 0xF0F0F0F0E1LL };
void setup()
{
Serial.begin(57600);
printf_begin();
radio.begin();
radio.openWritingPipe(0xF0F0F0F0);
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);
radio.setChannel(124);
radio.stopListening();
radio.printDetails();
}
void loop(void)
{
const char text[] = "Hello World";
Serial.print("envoi...");
radio.write(&text, sizeof(text));
delay(2000);
}
Arduino printDetails():
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x00f0f0f0f0 0xc2c2c2c2c2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x00f0f0f0f0
RX_PW_P0-6 = 0x20 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x7c
RF_SETUP = 0x23
CONFIG = 0x0c
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW
Raspberry Pi代码:
from RF24 import *
addresse = [0xF0F0F0F0E1]
radio = RF24(22, 0)
print('Réception de données')
radio.begin()
radio.setPALevel(RF24_PA_LOW)
radio.setDataRate(RF24_250KBPS)
radio.setChannel(124)
radio.printDetails()
print('Prêt a recevoir les données...')
radio.openReadingPipe(1,addresse[0])
radio.startListening()
while 1:
if radio.available():
while radio.available():
message = radio.read(32)
print('Message reçu = {} '.format(message))
Raspberry Pi printDetails():
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x00f0f0f0f0 0xf0f0f0f0e1
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x02
RF_CH = 0x7c
RF_SETUP = 0x23
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW