#include <RF24Network.h>
uint8_t myKey[16] = {1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6};
RF52Network network(radio);
const uint16_t this_node = 01;
const uint16_t other_node = 00;
const unsigned long interval = 2000;
unsigned long last_sent;
unsigned long packets_sent;
struct payload_t {
unsigned long ms;
unsigned long counter;
};
void setup(void) {
Serial.begin(115200);
while (!Serial) {
}
Serial.println(F("RF24Network/examples/helloworld_tx/"));
Serial.println(F("Radio hardware not responding!"));
while (1) {
}
}
network.begin( this_node);
}
void loop() {
network.update();
unsigned long now = millis();
if (now - last_sent >= interval) {
last_sent = now;
Serial.print(F("Sending... "));
payload_t payload = { millis(), packets_sent++ };
RF24NetworkHeader header( other_node);
bool ok = network.write(header, &payload, sizeof(payload));
Serial.println(ok ? F("ok.") : F("failed."));
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
void setChannel(uint8_t channel)
void setKey(uint8_t key[CCM_KEY_SIZE])
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)