#include "Arduino.h"
#include "TZ51_SONAR1.h"

int mesure_distance_cm(byte trig_pin,byte dist_pin)
{
  digitalWrite(trig_pin,HIGH);
  delayMicroseconds(1000);
  digitalWrite(trig_pin,LOW);
  int value = (pulseIn(dist_pin,HIGH)/2)/29.1+2;
  if (value>255) { value=255; }
  delay(20);
  return value;
}