// by NMDW COTMD/


unsigned long time1 =0;
unsigned long time2 =0;

bool input_Status = false;
bool Prvious_input_Status = false;

void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);
pinMode(5, INPUT);

}


void loop() {
  // put your main code here, to run repeatedly:
input_Status = digitalRead(5); // Remove button bounce mode
if( not Prvious_input_Status && input_Status) // Previous low and current high  i.e. rising edge
{
    Serial.println("Rising Edge");
    time1=millis();
    Serial.print("Off duration : ");
    Serial.println(millis()-time2);
}


if(Prvious_input_Status && not input_Status) // Previous low and current high  i.e. rising edge
{
    Serial.println("Falling Edge");
    time2=millis();
    Serial.print("On duration : ");
    Serial.println(millis()-time1);
}







Prvious_input_Status = input_Status;

}