Test LED, Button Interrupt, Sleepmode, Ticker
Since i get my Nucleo-F401RE i like to docu my tests
- interesting for me was, that only one LED (LED1 or PA_5) can be used for coding.
- a nice thing is, that the LEDs have a lovely brightness (compared to mbed-LPC1768)
- However the sleepmodes are working :)
deepsleep()
in deep sleep the system seems to do nothing and can be reactivated by an external interrupt (i haven't read the manual yet, so i only see this with the code)
this test is based on
Import programInterruptIn_HelloWorld
Hello World for InterruptIn
Import programTicker_HelloWorld
Hello World for Ticker
Import programNucleo_sleep
Enter in sleep or deepsleep modes.
[Repository '/teams/ST/code/Nucleo_blink_led/' not found]
Revision 0:3d1898f330d9, committed 2014-02-20
- Comitter:
- DAMEK
- Date:
- Thu Feb 20 12:11:55 2014 +0000
- Commit message:
- led, ticker, interruptin, sleepmode
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 3d1898f330d9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 20 12:11:55 2014 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" + +/** + * @file main.cpp + * @brief main file. + * + * @addtogroup FirstRun + * @author Andreas Rehn + * @date 20.02.2014 + * @brief Main module to test led, button und sleepmode together + * @warning functions run with sleep() and with deepsleep() the system must be start up with InterruptIn + * @{ + */ + +Ticker flipper; +InterruptIn button(USER_BUTTON); +DigitalOut led(LED1); + +/** function to flip the led */ +void flip(void) { + led = !led; +} + +/** main function + * initial param for led \n + * call function flip on rising edge of Button \n + * attach function flip to Ticker with 2 seconds intervall \n + * go to sleep or deepsleep (test the difference) \n + */ +int main(void) { + led = 1; + button.rise(&flip); + flipper.attach(&flip, 2.0); + sleep(); + //deepsleep(); + while(1) { + } +} +/** @} */ \ No newline at end of file
diff -r 000000000000 -r 3d1898f330d9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Feb 20 12:11:55 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ed8466a608b4 \ No newline at end of file