Cristian Castro / Mbed 2 deprecated Example05-HCSR04

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "hcsr04.h"
00003 
00004 
00005 //******* puerto serie *********//
00006 Serial Mbed(PB_6, PB_7);
00007 
00008 HCSR04  usensor(PA_13,PA_15);
00009 
00010 float dist;
00011 
00012 int main()
00013 {
00014 
00015     Mbed.printf("AT+RESET\n\CR");
00016     Mbed.printf("Let's Work !! \n");
00017     while(1) {
00018         usensor.start();
00019         wait_ms(500); 
00020         dist=usensor.get_dist_cm();
00021         Mbed.printf("\n cm:%.3f",dist );
00022  
00023         
00024     }
00025 }