Hello everybody,
This is my first post so first of all, hello whoever is reading this ;D
Well my problem is this:
I've one sketch with NRF24L01 working fine, but the problem is
The emiter sketch is like this:
//...more code there
triggers[1] = analogRead(TRIGGER_LEFT);
map_triggers[1] = map(triggers[1],0,674,0,1023);
if(map_triggers[1]!=map_old_triggers[1]){
cValues[0] = TRIGGER_LEFT;
cValues[1] = map_triggers[1];
//sendControlValues(cValues);
radio.write(cValues, sizeof(cValues));
}
map_old_triggers[1] = map_triggers[1];
//...more code there
On receiver sketch simply this:
//...more code there
while(radio.available()){
radio.read(&value, sizeof(value));
Serial.print(" Pin=");
Serial.print(value[0]);
Serial.print(" Value=");
Serial.println(value[1]);
}
//...more code there
The sketches over here work perfectly, i receive both values of the array perfectly, but as I've to manage more triggers and joystick axes an add some sentences on each I prefer to do a function so i can send the arrays of several analogic sources, below it's the function:
void sendControlValues(int Values[2]){
bool ok = radio.write(Values, sizeof(Values) );
if (ok){
Serial.print(" OK!");
}
else{
Serial.println(" FAIL!");
}
}
And now the problem, while on the first case (without the function) I'm receiving perfectly both array values (value[0] and value[1]) on the second case I'm only receiving value[0] correctly, value[1] it's always 0 on receiver!!!
Inside the sendControlValues() if I print value[0] and value[1] it's printing the required value, print what should be printed but anyway I'm receiving always 0 at value[1] of the receiver.
I don't understand what I'm doing wrong. Simple case works perfectly but just inside a function not... ![]()
Thanks for your help :-[