user45679: I have a beginner's problem. I have 2 nRF24L01+ devices. They are communicating with each other great, and I can talk with the nRF via SPI.
The problem is I want to display, on the serial monitor, the number of retransmitted packets (ARC_CNT) and the number of lost packets (PLOS_CNT), which are both in the "observe_tx" register on the nRF.
I am using the "Getting Started" example from RF24 1.3.1, with Arduino 1.84, with a few more bits added, and it all works great apart from getting it to show PLOS_CNT & ARC_CNT! I have tried: 
printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n")); 

But this does not give the correct result.
As you have probably guessed, I know nothing about C or C++. There must be a simple way of showing the 2 numbers?
The code I am using is:
#include <SPI.h>
#include "RF24.h"
#include <printf.h> // Required for "radio.printDetails();"

/****************** User Config ***************************/
/***      Set this radio as radio number 0 or 1         ***/
bool radioNumber = 0;

/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7 & 8 */
RF24 radio(7, 8);
/**********************************************************/

byte addresses[][6] = {"1Node", "2Node"};

// Used to control whether this node is sending or receiving
bool role = 0;

void setup() {
  //pinMode(53,OUTPUT); //may not be required after all
  Serial.begin(115200);
  printf_begin(); //required for "radio.printDetails();" to work
  Serial.println(F("RF24/examples/GettingStarted"));
  Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));
  radio.begin();
  // 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); // _MIN, _LOW, _HIGH, _MAX
  radio.setDataRate(RF24_250KBPS); //250KBPS, _1MBPS, _2MBPS  Lowest rate gives longest range.
  radio.setChannel(108); // 0 - 124 (2.4GHz - 2.524GHz) Usually above 100 best. USA 70 - 80 best.
  radio.setRetries(15, 15); // set retry delay and no of retries. delay between retries, 0=250uS, 15 = 4000uS
  radio.setCRCLength(RF24_CRC_16);  // 8 or 16 bit crc
  radio.printDetails();
  Serial.print(radio.getChannel());
  radio.setAutoAck(1);
  // Open a writing and reading pipe on each radio, with opposite addresses
  if (radioNumber) {
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1, addresses[0]);
  } else {
    radio.openWritingPipe(addresses[0]);
    radio.openReadingPipe(1, addresses[1]);
  }
  // Start the radio listening for data
  radio.startListening();
}

void loop() {
  /****************** Ping Out Role ***************************/
  if (role == 1)  {
    radio.stopListening(); // First, stop listening so we can talk.
    Serial.println(F("Now sending"));
    unsigned long start_time = micros();
    // Take the time, and send it.  This will block until complete
    if (!radio.write( &start_time, sizeof(unsigned long) )) {
      Serial.println(F("failed"));
    }
    radio.startListening(); // Now, continue listening
    unsigned long started_waiting_at = micros(); // Set up a timeout period, get the current microseconds
    boolean timeout = false; // Set up a variable to indicate if a response was received or not
    while (!radio.available()) {
      // While nothing is received
      if (micros() - started_waiting_at > 200000 ) {
        // If waited longer than 200ms, indicate timeout and exit while loop
        timeout = true;
        break;
      }
    }

    if (timeout) {
      // Describe the results
      Serial.println(F("Failed, response timed out."));
      printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n"));
    } else {
      unsigned long got_time;
      // Grab the response, compare, and send to debugging spew
      radio.read( &got_time, sizeof(unsigned long) );
      unsigned long end_time = micros();
      // Spew it
      Serial.print(F("Sent "));
      Serial.print(start_time);
      Serial.print(F(", Got response "));
      Serial.print(got_time);
      Serial.print(F(", Round-trip delay "));
      Serial.print(end_time - start_time);
      Serial.println(F(" microseconds"));
    }
    // Try again 1s later
    delay(1000);
  }

  /****************** Pong Back Role ***************************/
  if (role == 0) {
    unsigned long got_time;
    if (radio.available()) {
      // Variable for the received timestamp
      while (radio.available()) {
        // While there is data ready
        radio.read(&got_time, sizeof(unsigned long));
        // Get the payload
      }
      radio.stopListening();
      // First, stop listening so we can talk
      radio.write(&got_time, sizeof(unsigned long));
      // Send the final one back.
      radio.startListening();
      // Now, resume listening so we catch the next packets.
      Serial.print(F("Sent response "));
      Serial.println(got_time);
    }
  }

  /****************** Change Roles via Serial Commands ***************************/

  if (Serial.available()) {
    char c = toupper(Serial.read());
    if (c == 'T' && role == 0) {
      Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK"));
      role = 1; // Become the primary transmitter (ping out)
    } else if (c == 'R' && role == 1) {
      Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK"));
      role = 0; // Become the primary receiver (pong back)
      radio.startListening();
    }
  }
} // Loop


user31105: printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n")); 

This should be
printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n"), 
 OBSERVE_TX, PLOS_CNT, ARC_CNT); 

Where the two variables contain the values.

first OBSERVE_TX= means the text that is literally printed
%02X is the format of the variable which is printed
OBSERVE_TX is the variable name 

The variable names should be in the same order as the formatting (%'s).
However, in your case the above will not result in the values you want. The items above (OBSERVE_PLOS_CNT and ARC_CNT) are offsets from an addres. What you want is to print the content of that address. Since I don't have an Arduino IDE nearby, you should find yourself the address, and use *(address + OBSERVE_PLOS_CNT). This will use the address, adds OBSERVE_PLOS_CNT, and * means it will show the content of that new address.
Btw, I'm not sure about the exact use of printf_P and PSTR.

45679: <p>I have a beginner's problem. I have 2 nRF24L01+ devices. They are communicating with each other great, and I can talk with the nRF via SPI.</p>

<p>The problem is I want to display, on the serial monitor, the number of retransmitted packets (ARC_CNT) and the number of lost packets (PLOS_CNT), which are both in the "observe_tx" register on the nRF.</p>

<p>I am using the "Getting Started" example from RF24 1.3.1, with Arduino 1.84, with a few more bits added, and it all works great apart from getting it to show PLOS_CNT &amp; ARC_CNT! I have tried: </p>

<pre><code>printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n")); 
</code></pre>

<p>But this does not give the correct result.</p>

<p>As you have probably guessed, I know nothing about C or C++. There must be a simple way of showing the 2 numbers?</p>

<p>The code I am using is:</p>

<pre><code>#include &lt;SPI.h&gt;
#include "RF24.h"
#include &lt;printf.h&gt; // Required for "radio.printDetails();"

/****************** User Config ***************************/
/***      Set this radio as radio number 0 or 1         ***/
bool radioNumber = 0;

/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7 &amp; 8 */
RF24 radio(7, 8);
/**********************************************************/

byte addresses[][6] = {"1Node", "2Node"};

// Used to control whether this node is sending or receiving
bool role = 0;

void setup() {
  //pinMode(53,OUTPUT); //may not be required after all
  Serial.begin(115200);
  printf_begin(); //required for "radio.printDetails();" to work
  Serial.println(F("RF24/examples/GettingStarted"));
  Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));
  radio.begin();
  // 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); // _MIN, _LOW, _HIGH, _MAX
  radio.setDataRate(RF24_250KBPS); //250KBPS, _1MBPS, _2MBPS  Lowest rate gives longest range.
  radio.setChannel(108); // 0 - 124 (2.4GHz - 2.524GHz) Usually above 100 best. USA 70 - 80 best.
  radio.setRetries(15, 15); // set retry delay and no of retries. delay between retries, 0=250uS, 15 = 4000uS
  radio.setCRCLength(RF24_CRC_16);  // 8 or 16 bit crc
  radio.printDetails();
  Serial.print(radio.getChannel());
  radio.setAutoAck(1);
  // Open a writing and reading pipe on each radio, with opposite addresses
  if (radioNumber) {
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1, addresses[0]);
  } else {
    radio.openWritingPipe(addresses[0]);
    radio.openReadingPipe(1, addresses[1]);
  }
  // Start the radio listening for data
  radio.startListening();
}

void loop() {
  /****************** Ping Out Role ***************************/
  if (role == 1)  {
    radio.stopListening(); // First, stop listening so we can talk.
    Serial.println(F("Now sending"));
    unsigned long start_time = micros();
    // Take the time, and send it.  This will block until complete
    if (!radio.write( &amp;start_time, sizeof(unsigned long) )) {
      Serial.println(F("failed"));
    }
    radio.startListening(); // Now, continue listening
    unsigned long started_waiting_at = micros(); // Set up a timeout period, get the current microseconds
    boolean timeout = false; // Set up a variable to indicate if a response was received or not
    while (!radio.available()) {
      // While nothing is received
      if (micros() - started_waiting_at &gt; 200000 ) {
        // If waited longer than 200ms, indicate timeout and exit while loop
        timeout = true;
        break;
      }
    }

    if (timeout) {
      // Describe the results
      Serial.println(F("Failed, response timed out."));
      printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n"));
    } else {
      unsigned long got_time;
      // Grab the response, compare, and send to debugging spew
      radio.read( &amp;got_time, sizeof(unsigned long) );
      unsigned long end_time = micros();
      // Spew it
      Serial.print(F("Sent "));
      Serial.print(start_time);
      Serial.print(F(", Got response "));
      Serial.print(got_time);
      Serial.print(F(", Round-trip delay "));
      Serial.print(end_time - start_time);
      Serial.println(F(" microseconds"));
    }
    // Try again 1s later
    delay(1000);
  }

  /****************** Pong Back Role ***************************/
  if (role == 0) {
    unsigned long got_time;
    if (radio.available()) {
      // Variable for the received timestamp
      while (radio.available()) {
        // While there is data ready
        radio.read(&amp;got_time, sizeof(unsigned long));
        // Get the payload
      }
      radio.stopListening();
      // First, stop listening so we can talk
      radio.write(&amp;got_time, sizeof(unsigned long));
      // Send the final one back.
      radio.startListening();
      // Now, resume listening so we catch the next packets.
      Serial.print(F("Sent response "));
      Serial.println(got_time);
    }
  }

  /****************** Change Roles via Serial Commands ***************************/

  if (Serial.available()) {
    char c = toupper(Serial.read());
    if (c == 'T' &amp;&amp; role == 0) {
      Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK"));
      role = 1; // Become the primary transmitter (ping out)
    } else if (c == 'R' &amp;&amp; role == 1) {
      Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK"));
      role = 0; // Become the primary receiver (pong back)
      radio.startListening();
    }
  }
} // Loop
</code></pre>
 31105: <pre><code>printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n")); 
</code></pre>

<p>This should be</p>

<pre><code>printf_P(PSTR("OBSERVE_TX=%02x: PLOS_CNT=%x ARC_CNT=%x\r\n"), 
 OBSERVE_TX, PLOS_CNT, ARC_CNT); 
</code></pre>

<p>Where the two variables contain the values.</p>

<ul>
<li>first OBSERVE_TX= means the text that is literally printed</li>
<li>%02X is the format of the variable which is printed</li>
<li>OBSERVE_TX is the variable name </li>
</ul>

<p>The variable names should be in the same order as the formatting (%'s).</p>

<p>However, in your case the above will not result in the values you want. The items above (OBSERVE_PLOS_CNT and ARC_CNT) are offsets from an addres. What you want is to print the content of that address. Since I don't have an Arduino IDE nearby, you should find yourself the address, and use *(address + OBSERVE_PLOS_CNT). This will use the address, adds OBSERVE_PLOS_CNT, and * means it will show the content of that new address.</p>

<p>Btw, I'm not sure about the exact use of printf_P and PSTR.</p>
