Hello!
I use an InterruptIn for detecting a switch-change. The switch is directly connect to the mbed without an external Pull Up.
When I start or reset mbed, the Interrupt always triggers once. But the switch was not pressed.
Here is a test-programm:
#include "mbed.h"
//define digital interrupt pin
InterruptIn intPin(p23);
Serial pc(USBTX, USBRX); // tx, rx
// callback function when interrupted
void trigger() {
pc.printf("\n\rtriggered\r\n");
}
int main() {
//wait(1);
pc.printf("\n\rConnected to mBed\r\n");
intPin.mode(PullUp); // Enable internal pullup
wait(1); // no effect
intPin.fall(&trigger); // Call function
//intPin.rise(&trigger); // Call function
while(1) {
wait(1);
pc.printf(".");
}
}
Output:
Connected to mBed
triggered
........
Changing PullUp / PullDown has no effect on the "startup-trigger".
Waiting after setting the pin to PullUp doesn't change this.
How can I prevent InterruptIn from triggering on startup?
Regards - Charly
Hello!
I use an InterruptIn for detecting a switch-change. The switch is directly connect to the mbed without an external Pull Up.
When I start or reset mbed, the Interrupt always triggers once. But the switch was not pressed.
Here is a test-programm:
Changing PullUp / PullDown has no effect on the "startup-trigger".
Waiting after setting the pin to PullUp doesn't change this.
How can I prevent InterruptIn from triggering on startup?
Regards - Charly