Timer Örneği-3
Fork of Timer_HelloWorld by
Revision 1:f2a85aac8280, committed 2018-05-11
- Comitter:
- ctasdemir
- Date:
- Fri May 11 05:14:11 2018 +0000
- Parent:
- 0:27e1de20d3cb
- Commit message:
- Timer ?rne?i-3
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 |
--- a/main.cpp Wed Feb 13 17:28:57 2013 +0000
+++ b/main.cpp Fri May 11 05:14:11 2018 +0000
@@ -1,10 +1,34 @@
#include "mbed.h"
+
+Timer timer_1;
+Timer timer_2;
+
+DigitalOut led(LED1);
+
-Timer t;
+void task_1(void);
+void task_2(void);
int main() {
- t.start();
- printf("Hello World!\n");
- t.stop();
- printf("The time taken was %f seconds\n", t.read());
+ timer_1.start();
+ timer_2.start();
+ while(true){
+ if (timer_1.read() > 0.1) {
+ task_1();
+ timer_1.reset();
+ }
+ if (timer_2.read() > 1) {
+ task_2();
+ timer_2.reset();
+ }
+ }
}
+
+void task_1(void) {
+ led = !led;
+}
+void task_2(void) {
+ static int sayac = 0;
+ printf("Sayac:%d \n",sayac);
+ sayac++;
+}
\ No newline at end of file
--- a/mbed.bld Wed Feb 13 17:28:57 2013 +0000 +++ b/mbed.bld Fri May 11 05:14:11 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
