Library for Ultrasonic Range,

Dependents:   burobo_reciverV2 Nucleo_Ultrasonic-HCSR4 Test_UltraSonic Ultrasonic2 ... more

Ultrasonic Range HCSR04

This is a very easy example for use my library,

easy example

/**main.cpp*/
#include "mbed.h"
#include "hcsr04.h"
//D12 TRIGGER D11 ECHO
   HCSR04 sensor(D12, D11); 
int main() {
  while(1) {      
     long distance = sensor.distance();   
      printf("distanza  %d  \n",distance);
      wait(1.0); // 1 sec  
        
    }
}

All wikipages