Greetings
I'm working on a devices communicating in nRF24 network and at this moment I'm trying to send informations both ways but i have a issue with one void function called SendToMaster in slaves program (I have 3 slaves with mostly identical code).
When i try to compile the code I am faced with this error:
\Slave_2.ino: In function 'void SendToMaster(byte)':
Slave_2:55:44: error: invalid types 'const uint64_t {aka const long long unsigned int}[int]' for array subscript
exit status 1
invalid types 'const uint64_t {aka const long long unsigned int}[int]' for array subscript
Here's the program:
#include <RF24Network.h>
#include <RF24Network_config.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
RF24 radio(10, 9); //nRF24L01 pins (CE, CSN)
const uint64_t rAddress = 0xB00B1E50A4LL;
const uint64_t wAddress = 0xB00B1E50C3LL;
int LED = 0; // LED state
bool Hit = 0; //sensor state
void setup()
{
Serial.begin(57600);
Serial.println("Listening");
radio.begin();
radio.openReadingPipe(1, rAddress);
radio.startListening();
pinMode(3, OUTPUT); //LED green
pinMode(4, OUTPUT); //LED red
pinMode(5, OUTPUT); //LED blue
pinMode(8, INPUT); //vibration sensor
}
void loop()
{
byte pipe = 0;
while (radio.available(&pipe))
{
radio.read(&LED, sizeof(LED));
if (LED==1)
{
Serial.println("Light");
digitalWrite(3, HIGH);
unsigned long startTimer = millis();
SendToMaster(pipe);
}
if (LED==0)
{
Serial.println("Darkness");
digitalWrite(3, LOW);
SendToMaster(pipe);
}
}
}
void SendToMaster(byte xAddress)
{
radio.stopListening();
radio.openWritingPipe(wAddress[xAddress-1]);
radio.write(&LED, sizeof(LED));
Serial.println("Send back");
radio.startListening();
}
I'd be grateful for help with that issue and an explanation how to operate with the variable types in void, bool, int etc. functions