Arduino nRF2401+ 简单的 1 路传输不起作用

问题描述

我正在使用 2 个 Arduino nanos 和 2 个 NRF24L01+PA+LNA 模块。我大部分时间都在关注这个 tutorial,并且我已经验证了所有东西都连接到了正确的引脚。我也试过用 2 节 AA 电池直接为 nRF2401 模块供电,因为我听说板载 3.3v 并不总是足够。

发射器:

#include <SPI.h>
#include <RF24.h>
#include "printf.h"

RF24 radio(7,8); // CE,CSN
const uint64_t pAddress = 0xB00B1E5000LL;
#define DHT11_PIN 2

void setup(){
  Serial.begin(9600);
  printf_begin();
  if (!radio.begin()) {
    Serial.println(F("radio hardware is not responding!!"));
    while (1) {} // hold in infinite loop
  }
  radio.setPALevel(RF24_PA_LOW);
  radio.setChannel(25);
  radio.openWritingPipe(pAddress);
  radio.stopListening();
  radio.printDetails();
  radio.printPrettyDetails();
  Serial.print("channel = ");
  Serial.println(radio.getChannel());
}

void loop(){
  const char text[] = "Hello World";
  bool status = radio.write(&text,sizeof(text));
  Serial.print("Transmission Status: ");
  Serial.println(status);

  delay(1000);
 
}

发射机输出

SPI Speedz  = 10 Mhz
STATUS      = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1    = 0xb00b1e5000 0xc2c2c2c2c2
RX_ADDR_P2-5    = 0xc3 0xc4 0xc5 0xc6
TX_ADDR     = 0xb00b1e5000
RX_PW_P0-6  = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA       = 0x3f
EN_RXADDR   = 0x03
RF_CH       = 0x19
RF_SETUP    = 0x03
CONfig      = 0x0e
DYNPD/FEATURE   = 0x00 0x00
Data Rate   = 1 MBPS
Model       = nRF24L01+
CRC Length  = 16 bits
PA Power    = PA_LOW
ARC     = 15
SPI Frequency       = 10 Mhz
Channel         = 25 (~ 2425 MHz)
RF Data Rate        = 1 MBPS
RF Power Amplifier  = PA_LOW
RF Low Noise Amplifier  = Enabled
CRC Length      = 16 bits
Address Length      = 5 bytes
Static Payload Length   = 32 bytes
Auto Retry Delay    = 1500 microseconds
Auto Retry Attempts = 15 maximum
Packets lost on
    current channel = 0
Retry attempts made for
    last transmission   = 15
Multicast       = disabled
Custom ACK Payload  = disabled
Dynamic Payloads    = disabled
Auto AckNowledgment = Enabled
Primary Mode        = TX
TX address      = 0xb00b1e5000
pipe 0 ( open ) bound   = 0xb00b1e5000
pipe 1 ( open ) bound   = 0xc2c2c2c2c2
pipe 2 (closed) bound   = 0xc3
pipe 3 (closed) bound   = 0xc4
pipe 4 (closed) bound   = 0xc5
pipe 5 (closed) bound   = 0xc6
channel = 25
Transmission Status: 0
Transmission Status: 0
Transmission Status: 0
...

接收者

#include <SPI.h>
#include <RF24.h>
#include "printf.h"

RF24 radio(7,CSN
const uint64_t pAddress = 0xB00B1E5000LL;

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setPALevel(RF24_PA_LOW);
  radio.setChannel(25);
  radio.openReadingPipe(1,pAddress);
  radio.startListening();
  printf_begin();
  radio.printDetails();
  radio.printPrettyDetails();
  Serial.print("channel = ");
  Serial.println(radio.getChannel());
}

void loop() {
    if (radio.available()) {
    char text[32] = "";
    radio.read(&text,sizeof(text));
    Serial.println(text);
  }
}

复活输出

SPI Speedz  = 10 Mhz
STATUS      = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1    = 0xe7e7e7e7e7 0xb00b1e5000
RX_ADDR_P2-5    = 0xc3 0xc4 0xc5 0xc6
TX_ADDR     = 0xe7e7e7e7e7
RX_PW_P0-6  = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA       = 0x3f
EN_RXADDR   = 0x02
RF_CH       = 0x19
RF_SETUP    = 0x03
CONfig      = 0x0f
DYNPD/FEATURE   = 0x00 0x00
Data Rate   = 1 MBPS
Model       = nRF24L01+
CRC Length  = 16 bits
PA Power    = PA_LOW
ARC     = 0
SPI Frequency       = 10 Mhz
Channel         = 25 (~ 2425 MHz)
RF Data Rate        = 1 MBPS
RF Power Amplifier  = PA_LOW
RF Low Noise Amplifier  = Enabled
CRC Length      = 16 bits
Address Length      = 5 bytes
Static Payload Length   = 32 bytes
Auto Retry Delay    = 1500 microseconds
Auto Retry Attempts = 15 maximum
Packets lost on
    current channel = 0
Retry attempts made for
    last transmission   = 0
Multicast       = disabled
Custom ACK Payload  = disabled
Dynamic Payloads    = disabled
Auto AckNowledgment = Enabled
Primary Mode        = RX
TX address      = 0xe7e7e7e7e7
pipe 0 (closed) bound   = 0xe7e7e7e7e7
pipe 1 ( open ) bound   = 0xb00b1e5000
pipe 2 (closed) bound   = 0xc3
pipe 3 (closed) bound   = 0xc4
pipe 4 (closed) bound   = 0xc5
pipe 5 (closed) bound   = 0xc6
channel = 25

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...