Shareef Jalloq
/
test
InterruptIn testcase.
Revision 0:d8cc88c47749, committed 2010-06-13
- Comitter:
- sjalloq
- Date:
- Sun Jun 13 20:35:15 2010 +0000
- Commit message:
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 Sun Jun 13 20:35:15 2010 +0000 @@ -0,0 +1,60 @@ +#include "mbed.h" + +InterruptIn up(p20); +InterruptIn dn(p19); +InterruptIn sel(p18); + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +/* Prototypes */ +void button_up(); +void button_down(); +void button_select(); + +int main() { + + /* Change the pullup mode of the buttons. */ + up.mode(PullUp); + dn.mode(PullUp); + sel.mode(PullUp); + + /* Init the LEDs */ + led1 = 0; + led2 = 1; + led3 = 0; + led4 = 1; + + /* Set the functions to call when a button is pushed. */ + //up.fall(&button_up); + //dn.fall(&button_down); + sel.fall(&button_select); + + while (1) { + wait(2); + led1 = !led1; + led2 = !led2; + led3 = !led3; + led4 = !led4; + } +} + +void button_up() { + led1 = !led1; + wait(1); +} + +void button_down() { + led2 = !led2; + wait(1); +} + +void button_select() { + led3 = !led3; + wait(1); +} + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jun 13 20:35:15 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a0336ede94ce