Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Nucleo_sleep by
Revision 3:bce615e05c62, committed 2017-05-24
- Comitter:
- suads
- Date:
- Wed May 24 16:29:51 2017 +0000
- Parent:
- 2:4a344badae18
- Commit message:
- RTC NUCLEO Periodic Wakeup
Changed in this revision
WakeUp.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4a344badae18 -r bce615e05c62 WakeUp.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WakeUp.lib Wed May 24 16:29:51 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/Sissors/code/WakeUp/#49ca85e8822f
diff -r 4a344badae18 -r bce615e05c62 main.cpp --- a/main.cpp Wed Aug 17 10:06:07 2016 +0000 +++ b/main.cpp Wed May 24 16:29:51 2017 +0000 @@ -1,5 +1,5 @@ #include "mbed.h" - +#include "WakeUp.h" InterruptIn event(USER_BUTTON); DigitalOut myled(LED1); @@ -15,6 +15,7 @@ int main() { + set_time(1495040081); // Set RTC time to Wed, 28 Oct 2009 11:35:37 int i = 0; printf("\nPress Button to enter/exit sleep & deepsleep\n"); @@ -22,24 +23,23 @@ event.fall(&pressed); while (1) { - - if ((go_to_sleep == 0) || (go_to_sleep == 2)) { - printf("%d: Running\n", i); - myled = !myled; - wait(1.0); - } + + + time_t seconds = time(NULL); + printf("Time = %s", ctime(&seconds)); + + char buffer[32]; + strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); + + - if (go_to_sleep == 1) { - myled = 0; - printf("%d: Entering sleep (press user button to resume)\n", i); - sleep(); - } - if (go_to_sleep == 3) { + WakeUp::set_ms(10000); + // if (go_to_sleep == 3) { myled = 0; printf("%d: Entering deepsleep (press user button to resume)\n", i); deepsleep(); - } + //} i++; }