안양어벤저스 / Mbed 2 deprecated Timer_copy

Dependencies:   mbed

Fork of Ticker_3 by Jiyoung Ahn

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers timer.cpp Source File

timer.cpp

00001 
00002 #include "mbed.h"
00003  
00004 DigitalIn button1(D4); // 버튼을 D4에 연
00005  
00006 
00007  
00008 Timer timer;
00009  
00010 int main() 
00011 {
00012     button1.mode(PullUp);       // Set PullUp
00013     
00014     timer.start();              // Start the timer
00015    printf("Timer Start!\n");
00016     
00017     while(1)
00018     {
00019         if(button1 == 0)        // if push the button1
00020         {
00021             timer.stop();       // Stop the timer
00022             printf("%f seconds\n", timer.read());  
00023             break;
00024         }
00025     }
00026 }
00027 
00028 //[출처] ARM mbed 기초 강좌 : 12. 타이머 (스위치 및 가상 시리얼 통신 이용) (오픈소스 소프트웨어 & 하드웨어: 로봇 기술 공유 카페 (오로카)) |작성자 표윤석
00029