Skip to content

Instantly share code, notes, and snippets.

@yarogniew

yarogniew/Transmitter_nRF24_check.ino Secret

Last active Nov 13, 2019
Embed
What would you like to do?
Check if nRF24 works
// nadajnik
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
bool DEBUG = true;
char msg[6] = "hello";
RF24 radio(7, 8); //atmega328
//RF24 radio(12, 14, 26, 25, 27); // ESP32
//RF24 radio(2, 4); // nodeMCU ESP8266
const uint64_t pip = 0xE8E8F0F0E1LL;
void setup(void) {
Serial.begin(115200);
radio.begin();
radio.setChannel(2);
radio.setPayloadSize(7);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_HIGH);
radio.openWritingPipe(pip);
}
void loop(void) {
bool ok = radio.write(msg, 6);
if (ok && DEBUG) {
Serial.println("send");
}
else {
Serial.println("error");
}
delay(3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.