EasyManua.ls Logo

Ai-Thinker nRF24L01 - Nano Receive Code

Ai-Thinker nRF24L01
51 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 myRadio (7, 8);
byte addresses[][6] = {"1Node"};
int dataReceived;
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println(F("RF24/Simple Receive data Test"));
myRadio.begin();
myRadio.setChannel(108);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openReadingPipe(1, addresses[0]);
myRadio.startListening();
}
void loop()
{
if (myRadio.available())
{
while (myRadio.available())
{
myRadio.read( &dataReceived, sizeof(dataReceived) );
}
Serial.print("Data received = ");
Serial.println(dataReceived);
}
}
21 / 51
Nano