Helmut Tschemernjak
/
Nucleo_blink_led_deepsleep
I little test which wakes up from deepsleep via user buttom click and turns on the LED.
Revision 0:3208dcf3974f, committed 2016-09-22
- Comitter:
- Helmut64
- Date:
- Thu Sep 22 13:05:35 2016 +0000
- Commit message:
- Updated test deepsleep;
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 3208dcf3974f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 22 13:05:35 2016 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +InterruptIn event(USER_BUTTON); + +Serial ser(USBTX, USBRX); + +bool pressed = false; + +void KeyPressed() +{ + ser.printf("Key Pressed\r\n"); + pressed = true; +} + +int main() { + ser.baud(230400); + ser.printf("Hello, World\r\n"); + event.fall(&KeyPressed); + + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(1.0); + if (pressed) { + deepsleep(); + pressed = false; + } + } +}
diff -r 000000000000 -r 3208dcf3974f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 22 13:05:35 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/abea610beb85 \ No newline at end of file