button_stopwatch
Dependencies: mbed
Fork of Ticker_3 by
timer.cpp
- Committer:
- ajy912
- Date:
- 2017-10-16
- Revision:
- 5:01d245da7bdf
File content as of revision 5:01d245da7bdf:
#include "mbed.h" DigitalIn button1(D4); // 버튼을 D4에 연 Timer timer; int main() { button1.mode(PullUp); // Set PullUp timer.start(); // Start the timer printf("Timer Start!\n"); while(1) { if(button1 == 0) // if push the button1 { timer.stop(); // Stop the timer printf("%f seconds\n", timer.read()); break; } } } //[출처] ARM mbed 기초 강좌 : 12. 타이머 (스위치 및 가상 시리얼 통신 이용) (오픈소스 소프트웨어 & 하드웨어: 로봇 기술 공유 카페 (오로카)) |작성자 표윤석