#define monitor_pin 14
void setup()
{
pinMode(monitor_pin , INPUT);
}
void loop()
{
unsigned long d1 = pulseIn(14, HIGH);
if (d1>0){//trigger function}
}
I know there is a function pulseIn(), but it doesnt really solve my problem. I just want to trigger a function when voltage change from LOW to HIGH/HIGH to LOW. pulseIn() need to wait for the voltage to back to original level which in my case will exceed 3 minutes and cause timeout.
How can I detect a voltage change other than pulseIn()?