RF24::write returns incorrect boolean


i using unos, , nrf24l01+ pcbs red wings power supply units.  there 1 master board communicating 1 slave.  slave has subroutine

code: [select]
   // dummy process simulate being done slave
   bool dummyprocessa()
   {
    // define confirmation message sent
    char confirmation[3] = { 'x', currentcommand, slavenumber };
   
    serial.print( "process " );
    serial.print( currentcommand );
    serial.println( " running" );

    // something
    ( int = 0; < 20; i++ )
    {
      serial.print( 'a' );
      delay( 250 );
    }  //  end for
    serial.println();

    radio.stoplistening();
    if  ( radio.write( &confirmation, sizeof( confirmation ) ) )
    {
      serial.println( "confirmation sent" );
    }
    else
    {
      serial.println( "confirmation not sent" ); 
    }  //  end if
    radio.startlistening();

    serial.print( "process " );
    serial.print( currentcommand );
    serial.println( " complete" );

    return true;
   }  // end dummyprocessa


when routine runs debug printout shows

code: [select]
process running
aaaaaaaaaaaaaaaaaaaa
confirmation not sent
process complete
slave waiting instruction


but debug printout in master unit reads

code: [select]
command sent a
command in memory >a<
  acknowledgement data 109, -4000, 1

slave 1 has completed task a

command sent b
command in memory >b<
  acknowledgement data 108, -4001, 1

slave 1 has completed task b


it obvious lines slave 1 has completed task a , slave 1 has completed task b confirmation in fact sent despite assertion slave printout confirmation not sent.

i using tmrh20 version of rf24::write, , according documentation should return "true if payload delivered false if not.  appears not.

is wrong code, or way works?



Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > RF24::write returns incorrect boolean


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor