Renaud Fivet / Mbed 2 deprecated uptime

Dependencies:   mbed

Fork of hello by Renaud Fivet

Files at this revision

API Documentation at this revision

Comitter:
rfivet
Date:
Sun May 29 09:03:07 2016 +0000
Parent:
4:d6bb51356400
Commit message:
Forked from hello. Endless loop and wait.

Changed in this revision

hello.cpp Show diff for this revision Revisions of this file
uptime.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/hello.cpp	Sun May 29 06:38:51 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-/* hello -- hello, world */
-
-#include "mbed.h"
-
-int main() {
-    printf( "hello, world\n") ;
-    return EXIT_SUCCESS ;
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uptime.cpp	Sun May 29 09:03:07 2016 +0000
@@ -0,0 +1,14 @@
+/* uptime -- logs the number of seconds past since startup */
+
+#include "mbed.h"
+
+int main() {
+    int secs ;
+
+    for( secs = 1 ;; secs += 1) {
+        wait( 1) ;
+        printf( "uptime: %d seconds\n", secs) ;
+    }
+
+    return EXIT_SUCCESS ;   /* never reach here */
+}
\ No newline at end of file