#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"


// Teensy 3.0
#define CE_PIN    5
#define CS_PIN    10

// Config Radio (CEPin, CSPin)
RF24 radio(CE_PIN, CS_PIN);


// Radio transmit pipe addresses 
const uint64_t pipe = 0xE8E8F0F0E1LL;
int txdata[1] = {0xA5};


void setup() {
 
  Serial.begin(9600);
  Serial.println("Starting up RF24\n");
  delay(1000);
  
  radio.begin();

  // optionally, increase the delay between retries & # of retries
  radio.setRetries(15,1);

  // Serial.println("Setting up channel");
  radio.setChannel(115);
  radio.setPALevel(RF24_PA_MAX);
  radio.openWritingPipe(pipe);


}

void loop() {

  bool sent = false;
  
  sent = radio.write(txdata, sizeof(int));
  Serial.println();
  
  if(!sent){ Serial.println("ON Byte Tx Failure"); }
  delay(50);
  txdata[0] = 0x5A;
  sent = radio.write(txdata, sizeof(int));
  Serial.println();
    
  if(!sent){ Serial.println("OFF Byte Tx Failure"); }
  delay(100);
  txdata[0] = 0xA5;


}