An example of handling/prioritizing different types of data passing through the RF24Network
#include <RF24.h>
#include "printf.h"
RF24 radio(7, 8);
const uint16_t this_node = 01;
const uint16_t other_node = 00;
uint8_t dataBuffer[33];
void setup() {
Serial.begin(115200);
printf_begin();
while (!Serial) {
}
Serial.println(F("RF24Network/examples/Network_Separation_TX/"));
if (!radio.begin()) {
Serial.println(F("Radio hardware not responding!"));
while (1) {
}
}
radio.setChannel(90);
network.begin( this_node);
radio.printDetails();
for (uint16_t i = 0; i < 33; i++) {
dataBuffer[i] = i;
}
}
uint32_t sendTimer = 0;
void loop() {
network.update();
if (millis() - sendTimer > 1000) {
sendTimer = millis();
Serial.println(F("Sending data..."));
bool ok = network.write(header, &dataBuffer, 33);
Serial.println(ok ? F("OK 1") : F("Fail 1"));
uint32_t someVariable = 1234;
ok = network.write(header2, &someVariable, sizeof(someVariable));
Serial.println(ok ? F("OK 2") : F("Fail 2"));
}
if (network.available()) {
network.read(header, &dataBuffer, 0);
}
}
Definition RF24Network.h:384
#define EXTERNAL_DATA_TYPE
Definition RF24Network.h:103