In this app i used a rising interruption
I want to add a Falling interruption with that same pin (pin2)
That is, if an interruption falling, go to another program
How do i do this
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
const byte interruptPin = 2;
const char* BASEURI="http://telegramiotbot.com/api/notify?token=";
const char* TOKEN_NOTIFY="XXXXXXXXXX";
bool interrupted=false;
/*
interrupt handler
*/
void inputChanged(){
interrupted=true;
}
void notify(const char* token){
HTTPClient http;
http.begin(String(BASEURI) + token);
int httpCode = http.GET();
}
void setup() {
WiFiManager wifiManager;
//wifiManager.resetSettings();
wifiManager.autoConnect("SmartHome");
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), inputChanged, RISING);
}
void loop() {
if(interrupted){
if((WiFi.status() == WL_CONNECTED)) {
notify(TOKEN_NOTIFY);
interrupted=false;
}
}
}