Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Ticker_3 by
main.cpp
- Committer:
- ajy912
- Date:
- 2017-10-15
- Revision:
- 4:af3ab097055c
- Parent:
- 3:9be917b0d07a
File content as of revision 4:af3ab097055c:
/* Ticker : 함수를 쓰는 시간에 시작하여 원하는 시간이 지나면 특정 함수를 호출하고
다시 초기화 하여 원하는 시간이 되면 호출하는 것을 반복한다.*/
/*결과: red_LED 5초동안 깜빡이다가 green_LED 5초동안 on유 반복*/
#include "mbed.h"
Ticker timer;
DigitalOut ledg(LED2);
DigitalOut ledr(LED1);
void attime() {
ledg =! ledg;
}
int main() {
ledg=1;
timer.attach(&attime,5); //메인 함수는 계속 실행이 되면서 5초 뒤에 attime을 호출한다. 반복적으로
while(1) {
ledr =! ledr;
wait(0.2);
}
}
