割り込みを利用して超音波測距センサーをバックグラウンドで計測し続けられます。
Dependents: escapeFromYou Sample_LinetraceWithSonicDist
Diff: SonicDist.cpp
- Revision:
- 4:84f4fa630726
- Parent:
- 3:b22567a5f7d6
- Child:
- 5:8629d31e5e1c
--- a/SonicDist.cpp Sat Jul 09 15:10:17 2016 +0000 +++ b/SonicDist.cpp Sat Jul 09 17:38:16 2016 +0000 @@ -58,14 +58,14 @@ SonicDist::setTrig(); if(startflag){printf("a");} } -double SonicDist::getDist(void){ +double SonicDist::read(void){ if(setmeasure){ SonicDist::init(); setmeasure=false; } return (double)dist/10; } -double SonicDist::getDist_mm(void){ +double SonicDist::read_mm(void){ if(setmeasure){ SonicDist::init(); setmeasure=false;