Create an Mbed program that - Outputs a string every time the button is pressed - Blinks LED1 if the button is pressed twice within two seconds - Use time_t seconds = time(NULL) to get current time

Files at this revision

API Documentation at this revision

Comitter:
vicara
Date:
Thu Nov 29 17:23:36 2018 +0000
Parent:
0:9758d6dc0132
Commit message:
2;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Nov 29 17:05:46 2018 +0000
+++ b/main.cpp	Thu Nov 29 17:23:36 2018 +0000
@@ -7,6 +7,7 @@
 time_t pressed_seconds = time(NULL);
 
 void blink_led(){
+    // Blink the led two times if button pressed two times in two seconds
     led1 = !led1;
     wait(0.5);
     led1 = !led1;
@@ -16,7 +17,6 @@
     led1 = !led1;
 }
 void rise_handler_thread_context(void) {
-//    printf("rise_handler_thread_context in context %p\r\n", Thread::gettid());
     if(pressed_seconds - time(NULL) > 2){
         pressed_seconds = time(NULL);
     } else {