Hi,
I have to trigger gpio interrupt and execute a service routine. I have found interrupt example in which interrupt triggers on low to high transition.
int button = 12;
int led = 11;
int ledState = 1;
void button_handler(uint32_t id, uint32_t event) {
if (ledState == 0) {
// turn on LED
ledState = 1;
digitalWrite(led, ledState);
} else {
// turn off LED
ledState = 0;
digitalWrite(led, ledState);
}
}
void setup() {
pinMode(led, OUTPUT);
digitalWrite(led, ledState);
pinMode(button, INPUT_IRQ_RISE);
digitalSetIrqHandler(button, button_handler);
}
void loop() {
delay(1000);
}
But I require interrupt that triggers on any transition i.e. from low to high and high to low as well. Morever I require a command to reboot controller using software.
Any help regarding that would be appretiated.Preformatted text