Matthias Planinsec
/
FTKL_board-Joystick_timer_entprellen_toggeln
5
Revision 0:57107e1f696c, committed 2015-06-06
- Comitter:
- Planinsec
- Date:
- Sat Jun 06 10:39:21 2015 +0000
- Commit message:
- 5
Changed in this revision
FTKL_board-Joystick_timer_entprellen_toggeln.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 57107e1f696c FTKL_board-Joystick_timer_entprellen_toggeln.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FTKL_board-Joystick_timer_entprellen_toggeln.cpp Sat Jun 06 10:39:21 2015 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +Timer timer1; +Timer timer2; +DigitalOut doLed1(LED1); +DigitalOut doLed2(LED2); +bool activTimer1 = true; +InterruptIn stopNgo(p15); + +// functions +void task1() { + doLed1 = !doLed1; +} +void task2() { + doLed2 = !doLed2; +} +void sgLed1() { + if (activTimer1) + timer1.stop(); + else + timer1.start(); + activTimer1 = !activTimer1; +} + +int main() { + timer1.start(); // start timer1 counting + timer2.start(); // start timer2 counting + stopNgo.rise(&sgLed1); + while(1) { + if (timer1.read_ms()>=200) { // read time + task1(); // call task1 function + timer1.reset(); // reset timer + } + if (timer2.read_ms()>=700) { // read time + task2(); // call task2 function + timer2.reset(); // reset timer + } + } +} \ No newline at end of file
diff -r 000000000000 -r 57107e1f696c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jun 06 10:39:21 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058 \ No newline at end of file