![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
xxx_Sonar-HC-SR04
main.cpp
- Committer:
- itbusch
- Date:
- 2022-02-23
- Revision:
- 1:1e73871289d7
- Parent:
- 0:b0a3597dffa9
File content as of revision 1:1e73871289d7:
#include "mbed.h" #include "HCSR04.h" DigitalOut myled(LED1); Serial pc(USBTX,USBRX); HCSR04 sonar(D2, D4); //Trigger, Echo int main() { printf("INICIO PROGRAMA\n"); while(1) { printf("Distanz %.2f cm \n\r", sonar.getCm()); pc.printf("Distancia %.2f cm \n\r",sonar.getCm()); wait_ms(1000); } }