Skip to content

Instantly share code, notes, and snippets.

@yarogniew
Created November 4, 2019 22:49
Show Gist options
  • Save yarogniew/12e2090764b70697c3bfbfacd5c49784 to your computer and use it in GitHub Desktop.
Save yarogniew/12e2090764b70697c3bfbfacd5c49784 to your computer and use it in GitHub Desktop.
Nadajnik nRF24 Arduino
// Arduino nadajnik
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
bool DEBUG = true;
char msg[6] = "hello";
RF24 radio(7, 8);
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