-
-
Save yarogniew/12e2090764b70697c3bfbfacd5c49784 to your computer and use it in GitHub Desktop.
Nadajnik nRF24 Arduino
This file contains 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
// 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