       }
     }
   } else {
+    // Sample Sensors here..
+    
     // Sleep for 8 seconds
     rf69.setMode(RFM69_MODE_SLEEP);
     LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

    int packet_len = gen_Data();
    rf69.send((uint8_t*)data, packet_len, rfm_power);
    
    if(battV > slow_freq_threshold) {
      data_interval = random(15, 20) + count;
      if(battV > repeat_threshold && zombie_mode==1) {
        rf69.setMode(RFM69_MODE_RX);
        zombie_mode=0;
      } else if (battV < repeat_threshold && zombie_mode==0) {
        rf69.setMode(RFM69_MODE_SLEEP);
        zombie_mode=1;
      }
    }
    else {
      data_interval = random(25, 30) + count;
    }
  }
}

float sampleBattv() {
  // External 4:1 Divider
  return ((float)analogRead(batt_pin)*1.1*4)/1023.0;
}

#include "RFM69.h"
#include "LowPower.h"

//************* Node ID Setup ****************/
char id[] = "P01";
char location_string[] = "50.9375,-1.3982";
uint8_t rfm_power = 20; // dBmW

//************* Sensors ****************/
// Battery Voltage Measurement - Also enables zombie mode
#define ENABLE_BATTV_SENSOR // Comment out to disable, also disables zombie mode
#define BATTV_PIN 0 //ADC 0 - Battery Voltage, scaled to 1.1V
#define BATTV_FUDGE 0.935
// RFM Temperature Sensor - Not very accurate and sometimes glitchy
#define ENABLE_RFM_TEMPERATURE // Comment out to disable
#define RX_TEMP_FUDGE 5.0 // Temperature offset when in RX due to self-heating

//************* Power Saving ****************/
#ifdef ENABLE_BATTV_SENSOR
  #define ENABLE_ZOMBIE_MODE // Comment this out to disable
#endif
uint8_t zombie_mode; // Stores current status: 0 - Full Repeating, 1 - Low Power shutdown, (beacon only)
#define ZOMBIE_THRESHOLD 3.65

//************* Misc Setup ****************/
byte num_repeats = '3'; //The number of hops the message will make before stopping
float battV=0.0;
uint8_t n, count = 1, data_interval = 10;
uint8_t data_count = 97; // 'a'
char data[64], string_end[] = "]";

// Singleton instance of the radio
RFM69 rf69(9.3); // parameter: RFM temperature calibration offset (degrees as float)

int gen_Data(){
  if(data_count=='a' or data_count=='z') {
      sprintf(data, "%c%cL%s", num_repeats, data_count, location_string);
  } else {
      sprintf(data, "%c%c", num_repeats, data_count);
  }
  
  #ifdef ENABLE_RFM_TEMPERATURE
  sprintf(data,"%sT%d",data,sampleRfmTemp());
  #endif
  
  #ifdef ENABLE_BATTV_SENSOR
  battV = sampleBattv();
  char* battStr;
  char tempStrB[14]; //make buffer large enough for 7 digits
  battStr = dtostrf(battV,7,2,tempStrB);
  while( (strlen(battStr) > 0) && (battStr[0] == 32) )
  {
     strcpy(battStr,&battStr[1]);
  }
  sprintf(data,"%sV%s",data,battStr);
  #endif
  
  #ifdef ENABLE_ZOMBIE_MODE
  sprintf(data,"%sZ%d",data,zombie_mode);
  #endif
  
  return sprintf(data,"%s[%s]",data,id);
}

void setup() 
