Problem with getting nRF24L01 modules to work


hi!
i have trouble getting nrf24l01 modules (version external antenna , pa) work. transmitter hooked arduino nano , receiver connected arduino mega.
code transmitter:
code: [select]
/*
* arduino wireless communication tutorial
*     example 1 - transmitter code
*               
* dejan nedelkovski, www.howtomechatronics.com
*
* library: tmrh20/rf24, https://github.com/tmrh20/rf24/
*/
#include <spi.h>
#include <nrf24l01.h>
#include <rf24.h>
rf24 radio(7, 8); // cns, ce
const byte address[6] = "00001";
void setup() {
  radio.begin();
  radio.openwritingpipe(address);
  radio.setpalevel(rf24_pa_min);
  radio.stoplistening();
}
void loop() {
  const char text[] = "hello world";
  radio.write(&text, sizeof(text));
  delay(1000);
}

code receiver:
code: [select]
/*
* arduino wireless communication tutorial
*       example 1 - receiver code
*               
* dejan nedelkovski, www.howtomechatronics.com
*
* library: tmrh20/rf24, https://github.com/tmrh20/rf24/
*/
#include <spi.h>
#include <nrf24l01.h>
#include <rf24.h>
rf24 radio(7, 8); // cns, ce
const byte address[6] = "00001";
void setup() {
  serial.begin(9600);
  radio.begin();
  radio.openreadingpipe(0, address);
  radio.setpalevel(rf24_pa_min);
  radio.startlistening();
}
void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    serial.println(text);
  } else {
    serial.println("unavailable.");
  }
}

when try run this, receiver outputs "unavailable". can please tell me can wrong?
there decoupling caps installed on 3v3 lines of arduino, don't think problem.

have @ simple nrf24l01+ tutorial. have kept examples simple possible , work. if have problems easier example familiar with.

the high-power nrf24 needs external 3.3v power supply - arduino 3.3v pin cannot provide enough current.

i believe can have problems high-power versions if tx , rx close each other because signal power high.

...r


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Problem with getting nRF24L01 modules to work


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts