Sandesh Kumar
/
rtes_lab1_p2
Polling
Revision 0:ecb474821d8f, committed 2015-02-02
- Comitter:
- sandeshkumar
- Date:
- Mon Feb 02 21:36:00 2015 +0000
- Commit message:
- Initial commit;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 02 21:36:00 2015 +0000 @@ -0,0 +1,69 @@ +#include "mbed.h" + +InterruptIn pin22(p22); +InterruptIn pin23(p23); +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +DigitalOut pin17(p17); +DigitalOut pin18(p18); +DigitalOut pin19(p19); +DigitalOut pin20(p20); + +void riseLed1() { + led1 = 1; +} + +void fallLed1() { + led1 = 0; +} + +void riseLed2() { + led2 = 1; +} + +void fallLed2() { + led2 = 0; +} + +int main() { + pin17 = 1; + pin18 = 1; + pin19 = 1; + pin20 = 1; + + pin22.rise(&riseLed1); // attach the address of the flip function to the rising edge + pin23.rise(&riseLed2); // attach the address of the flip function to the rising edge + pin22.fall(&fallLed1); + pin23.fall(&fallLed2); + while(1) { // wait around, interrupts will interrupt this! + wait(0.1); + } + + +} + +/*#include "mbed.h" +#include "keypad.h" + + // Define your own keypad values + char Keytable[] = { '1', '2', '3', 'A', + '4', '5', '6', 'B', + '7', '8', '9', 'C', + '*', '0', '#', 'D' + }; + + uint32_t cbAfterInput(uint32_t index) { + printf("Index:%d => Key:%c\n", key, Keytable[index]); + return 0; + } + + int main() { + Keypad keypad(p25, p26, p27, p28, p21, p22, p23, p24); + keypad.CallAfterInput(&cbAfterInput); + keypad.Start(); + + while (1) { + wait_ms(100); + } + }*/ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 02 21:36:00 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file