The experiment using this program was planned to be introduced on and after "Interface" No.11, CQ publishing Co.,Ltd, 2014. 本プログラムを使った実験は,CQ出版社のインターフェース 2014年11月号以降で紹介する予定でした.
Ticker_10kHz.cpp
- Committer:
- CQpub0Mikami
- Date:
- 2014-07-15
- Revision:
- 0:07aed8c7ef5e
File content as of revision 0:07aed8c7ef5e:
//-------------------------------------------------------- // Rectangular wave generator using Ticker class // frequency : 10 kHz // output : D8 pin // Copyright (c) 2014 MIKAMI, Naoki, 2014/07/14 //-------------------------------------------------------- #include "mbed.h" Ticker timer_; DigitalOut pinOut_(D8); int flip_ = 0; void TimerIsr() { pinOut_.write(flip_); // pinOut = flip_; flip_ = !flip_; } int main() { // interval: 50 micro seconds timer_.attach_us(&TimerIsr, 50); while(true) {} }