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
Diff: main.cpp
- Revision:
- 1:916c0b2b9f1c
- Parent:
- 0:9758d6dc0132
diff -r 9758d6dc0132 -r 916c0b2b9f1c main.cpp --- 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 {