Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 2 months ago.
External Interrupt Generation on a LPC1768
Hi,
I am just trying an external interrupt in LPC1768. I have a problem here. To my knowledge , the code attached below will toggle the led for every 5 seconds , as I have called both rise and fall parameters. But that does not happen on LED1. Is my program right for togglinh the led1 every 5 sec?? I just want to know where I go wrong...
#include "mbed.h" InterruptIn button(p18); // Interrupt on digital pushbutton input p18 DigitalOut led1(LED1); // digital out to p5 DigitalOut Input_Signal(p5); void toggle(void); // function prototype int main() { button.rise(&toggle); // attach the address of the toggle ---> InterruptIn button(p18); button.fall(&toggle); while(1) { Input_Signal = 0; // Given in P5 ---> DigitalOut Input_Signal(p5); wait_ms(5000); Input_Signal = 1; wait_ms(5000); } } void toggle() { led1=!led1; }
Regards, RamPrasadh N