nRF24L01+ Transceiver Module

Posted

Specifications:
  • 4-pin Serial Peripheral Interface (SPI)
  • maximum data rate of 10Mbps
  • 125 selectable channels
  • output power (0 dBm, -6 dBm, -12 dBm or -18 dBm) can be configured through the SPI interface
  • data rate (250kbps, 1Mbps, or 2Mbps) can be configured through the SPI interface


Transmitter code:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10);  // CE, CSN
const byte address[6] = "00001";
void setup()
{
  radio.begin();
  radio.openWritingPipe(address);
  radio.stopListening();
}
void loop()
{
  const char text[] = "TESTING 1 2 3, TESTING"; //message
  radio.write(&text, sizeof(text));
  delay(1000);
}
Receiver code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9,10);  // CE, CSN
const byte address[6] = "00001";
void setup()
{
  while (!Serial);
    Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.startListening();
}
void loop()
{
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

Author
Categories ,