Tj Maher
/
Lab1-2DigitalInterrupts
Revision 0:5b8d5174372e, committed 2019-05-22
- Comitter:
- t00203959
- Date:
- Wed May 22 20:25:59 2019 +0000
- Commit message:
- Lab1-2digitalinterrupts
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 |
diff -r 000000000000 -r 5b8d5174372e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed May 22 20:25:59 2019 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" + +Serial pc(USBTX,USBRX); +InterruptIn left(p13); +InterruptIn down(p12); +InterruptIn right(p16); +InterruptIn up(p15); +InterruptIn centre(p14); + +void Down() +{ + pc.printf("Down\n"); + wait_ms(75);//added wait command to eliminate the repeated operation of the function before the voltage is fixed +} +void Left() +{ + pc.printf("Left\n"); + wait_ms(75); +} +void Centre() +{ + pc.printf("Centre\n"); + wait_ms(75); +} +void Up() +{ + pc.printf("Up\n"); + wait_ms(75); +} +void Right() +{ + pc.printf("Right\n"); + wait_ms(75); +} + +int main() +{ + while(1) { + wait (5); + down.rise(&Down); + left.rise(&Left); + centre.rise(&Centre); + up.rise(&Up); + right.rise(&Right); + down.rise(&Down); + wait(5); + } + + +}
diff -r 000000000000 -r 5b8d5174372e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed May 22 20:25:59 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file