Timer Örneği-3

Dependencies:   mbed

Fork of Timer_HelloWorld by mbed official

main.cpp

Committer:
ctasdemir
Date:
2018-05-11
Revision:
1:f2a85aac8280
Parent:
0:27e1de20d3cb

File content as of revision 1:f2a85aac8280:

#include "mbed.h"

Timer timer_1;
Timer timer_2;

DigitalOut led(LED1);

 
void task_1(void);
void task_2(void);
 
int main() {
  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++;
}