#include #include "RF24.h" #include #include "TransferDataStructure.h" // Nrf24 settings RF24 radio(9, 10); // CE, CSN RF24Network network(radio); const uint16_t this_node = 00; // Address of our node in Octal format const uint16_t other_node = 01; // Address of the other node in Octal format void NrfInit() { SPI.begin(); radio.begin(); network.begin(/*channel*/ 90, /*node address*/ this_node); // Set the PA Level low to prevent power supply related issues since this is a // getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default. radio.setPALevel(RF24_PA_LOW); } dataStruct2 NrfSendData(dataStruct2 data, bool debug = false) { network.update(); if (debug) Serial.print("Sending..."); RF24NetworkHeader header(/*to node*/ other_node); bool ok = network.write(header, &data, sizeof(data)); if (debug) { if (ok) Serial.println("ok."); else Serial.println("failed."); } return data; }