#include "RF24Network.h"
#include "RF24Mesh.h"
uint8_t myKey[16] = {1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6};
RF52Network network(radio);
RF52Mesh mesh(radio, network);
uint32_t displayTimer = 0;
void setup() {
Serial.begin(115200);
while (!Serial) {
}
mesh.setNodeID(0);
Serial.println(mesh.getNodeID());
if (!mesh.begin()) {
Serial.println(F("Radio hardware not responding."));
while (1) {
}
}
}
void loop() {
mesh.update();
mesh.DHCP();
if (network.available()) {
RF24NetworkHeader header;
network.peek(header);
uint32_t dat = 0;
switch (header.type) {
case 'M':
network.read(header, &dat, sizeof(dat));
Serial.println(dat);
break;
default:
network.read(header, 0, 0);
Serial.println(header.type);
break;
}
}
if (millis() - displayTimer > 5000) {
displayTimer = millis();
Serial.println(" ");
Serial.println(F("********Assigned Addresses********"));
for (int i = 0; i < mesh.addrListTop; i++) {
Serial.print("NodeID: ");
Serial.print(mesh.addrList[i].nodeID);
Serial.print(" RF24Network Address: 0");
Serial.println(mesh.addrList[i].address, OCT);
}
Serial.println(F("**********************************"));
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
void setKey(uint8_t key[CCM_KEY_SIZE])
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)