![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Timeout Örneği
Dependencies: mbed
Fork of Timer_HelloWorld by
Revision 1:640a6cabee81, committed 2018-05-11
- Comitter:
- ctasdemir
- Date:
- Fri May 11 05:14:35 2018 +0000
- Parent:
- 0:27e1de20d3cb
- Commit message:
- Timeout ?rne?i
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 27e1de20d3cb -r 640a6cabee81 main.cpp --- a/main.cpp Wed Feb 13 17:28:57 2013 +0000 +++ b/main.cpp Fri May 11 05:14:35 2018 +0000 @@ -1,10 +1,27 @@ #include "mbed.h" - -Timer t; - + +Timeout response; +DigitalIn button (USER_BUTTON); +DigitalOut led1(LED1); + +void led_set(void); +void led_clear(void); + int main() { - t.start(); - printf("Hello World!\n"); - t.stop(); - printf("The time taken was %f seconds\n", t.read()); + while(true) { + if(button == 0){ // Butona basıldı ise + response.attach(&led_set, 3.0); + } + printf("buton girisi bekleniyor!\n"); + wait(0.2); + } } + +void led_set(void) { + led1 = 1; + response.attach(&led_clear, 2.0); +} + +void led_clear(void) { + led1 = 0; +}
diff -r 27e1de20d3cb -r 640a6cabee81 mbed.bld --- a/mbed.bld Wed Feb 13 17:28:57 2013 +0000 +++ b/mbed.bld Fri May 11 05:14:35 2018 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file