 
 RF24 radio(PIN_CE, PIN_CSN);
 
-/**
- * Be carefull to ensure the struct size is the same as on the Pi.
- * Just having the same size variables is not enough.
- * @see http://www.delorie.com/djgpp/v2faq/faq22_11.html
- */
-typedef struct{
-  int32_t timestamp;
-  uint16_t msg_id;
-  uint16_t vcc;
-  uint16_t a;
-  uint16_t b;
-  uint16_t c;
-  uint16_t d;
-  uint8_t type;
-  uint8_t device_id;
-  int8_t y;
-  int8_t z;
-}
-payload_t;
-payload_t payload;
-
+Nrf24Payload rx_payload = Nrf24Payload();
+uint8_t rx[Nrf24Payload_SIZE];
 
 uint16_t msg_id = 0;
 

  
  // Setup and configure rf radio
  radio.begin(); // Start up the radio
  radio.setPayloadSize(sizeof(payload_t)); 
  radio.setAutoAck(1); // Ensure autoACK is enabled
  radio.setRetries(0,15); // Max delay between retries & number of retries
  // Allow optional ack payloads

    radio.writeAckPayload(1, &ack, sizeof(ack));
    ack++; 

    radio.read( &rx, Nrf24Payload_SIZE); 
    processPayload();
    
  }
