#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10 

RF24 radio(9,10);

//
// Topology
//

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipe = 0xE8E8F0F0E1LL;
   
int beats[1];

void setup()
{
  Serial.begin(115200);
  radio.begin();

  
 //   radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipe);
    radio.startListening();
    
}

boolean is_being_read = false;

void loop()
{
  if (is_being_read){
    return; 
  }
  
  if (radio.available()) {
      // Dump the payloads until we've gotten everything
      is_being_read = true;      
      bool done = false;
      while(!done) {
      
      done = radio.read( &beats, sizeof(beats) );
      // Spew it
    //    Serial.print('-');
        Serial.println(beats[0]);
        
     //    Serial.print('B');
     //   Serial.println(beats[1]);   
   
      //   Serial.print('Q');
      //  Serial.println(beats[2]);
        
        


  //    delay(200);
}
}
  is_being_read = false;
}

  
  
  


