Last active
March 20, 2020 12:44
-
-
Save mithi/ffbfb37bd6324740933b867b8fc84347 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <nRF24L01.h> | |
#include <RF24.h> | |
#include <printf.h> | |
#define CE_PIN 9 | |
#define CSN_PIN 10 | |
RF24 radio(CE_PIN, CSN_PIN); | |
const byte ADDRESS[6] = "00001"; | |
void setup() { | |
while (!Serial); | |
Serial.begin(9600); | |
printf_begin(); | |
radio.begin(); | |
//radio.setAutoAck(false); | |
radio.setDataRate(RF24_2MBPS); | |
//RF24_1MBPS, RF24_2MBPS | |
radio.setPALevel(RF24_PA_MIN); | |
//RF24_PA_LOW, RF24_LOWMBPS | |
radio.setRetries(3,5); | |
// delay, count | |
radio.openReadingPipe(0, ADDRESS); | |
radio.startListening(); | |
radio.printDetails(); | |
} | |
void loop() { | |
if (radio.available()) { | |
char text[32] = ""; | |
radio.read(&text, sizeof(text)); | |
Serial.println(text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment