Last active
March 20, 2020 12:44
-
-
Save mithi/ecfeb4d0adb313d14852ff2f1590f50e 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"; | |
const char TEXT[] = "Hello world! Watchout!"; | |
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_LOW | |
radio.setRetries(3, 5); | |
// delay, count | |
radio.openWritingPipe(ADDRESS); | |
radio.stopListening(); | |
radio.printDetails(); | |
} | |
void loop(){ | |
radio.write(&TEXT, sizeof(TEXT)); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment