 const int ledPin    = 14;
 
 int rangeStatus;
-
-unsigned long counterForloop;
+volatile unsigned long counterForloop;
 volatile unsigned long counterForloop_old;
+volatile boolean checkRangenow;
+volatile int noOfWake;
+
+void checkRange() {
+  checkRangenow = true;
+}
 
 void wakeUp() {
+  noOfWake++;
   counterForloop_old = counterForloop;
+  checkRangenow = true;
+
   detachInterrupt(digitalPinToInterrupt(2));
+
+  attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(microPin), checkRange, CHANGE);
+  attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(nanoPin), checkRange, CHANGE);
 }
 
 void sleepNow() {
+  detachPinChangeInterrupt(digitalPinToPinChangeInterrupt(microPin));
+  detachPinChangeInterrupt(digitalPinToPinChangeInterrupt(nanoPin));
+
   digitalWrite(ledPin, LOW);
   attachInterrupt(digitalPinToInterrupt(2), wakeUp, FALLING);
   LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
 }
 
-void checkBttn() {
+void checkRecordBttn() {
   attachInterrupt(digitalPinToInterrupt(2), sleepNow, FALLING);
 }
 

  rangeStatus = microStatus << 1;
  rangeStatus = rangeStatus + nanoStatus;

  counterForloop = 0;

  // radio
  radio.begin();

   16 / 15 ---> detect range ( m / u / n )
*/

#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
