![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sc04
main.cpp
- Committer:
- hypark
- Date:
- 2018-05-30
- Revision:
- 1:b424b6de3632
- Parent:
- 0:f03a985dcde2
File content as of revision 1:b424b6de3632:
#include "mbed.h" #include "HCSR04.h" Serial pc(USBTX, USBRX); // USART2 : PA2,PA3 HCSR04 u_sen(PC_7, PA_9); // 초음파 센서 int main() { float dist = 0; while(1) { u_sen.startMeas(); //거리 측정 wait(0.1); u_sen.getMeas(dist); //m단위 변환 pc.printf("DIST %0.2fm \r\n",dist); //출력 wait(0.2); // delay 200 ms } }