Accurate sensor

Accurate sensor

SODIAL (R) HC-SR04 Distance Measuring Ultrasonic sensor module for Arduino (Electronics)

Customer Review

This sensor is accurate to the centimeter and has a very narrow angle of view in front of him!
Here is the code of a program to capture its values:
int trig = 7;
echo int = 8;
time int = 0;
int distance = 0;

void setup ()
{
pinMode (trig, OUTPUT); // Config pines and zeroing the echo pin
digitalWrite (trig, LOW);
pinMode (echo, INPUT);
Serial.begin (9600); // Démarage Serial at 9600 baud
}

void loop ()
{
digitalWrite (trig, HIGH); // Send a pulse of 10 microseconds
delayMicroseconds (10);
digitalWrite (trig, LOW);
time = pulseIn (echo, HIGH); // Measure the length of the return pulse
distance = time / 58; // Aplique the conversion formula in centimeters
Serial.print ("Distance ="); // Write in the series window Remote
Serial.println (distance);
delay (50); // Repeat the operation every 50 millisecond
}

Related Reviews


Great idea, but so far poorly implementedTFA Dostmann professional thermo-hygrometer with data logger function KlimaLogg per 303039 (Garden & Outdoors) The best compact.Sony Cyber-shot DSC-RX100M3 Digital compact camera 20.9 Megapixel Optical Zoom 3x Wifi / NFC Black (Electronics) 2 points for the retro effectWings of Fury - First Strike (App) Expensive weather station to "take away"Netatmo weather station for iPhone, Android and Windows Phone (Electronics) Range is very bad!TFA Dostmann Thermo-hygro transmitter with display 30.3180.IT (garden products) If Batman had a clock ...Casio Men's Watch XL Digital Quartz Resin GW 9400-1ER (clock) Works exactly hammer !!!Leap Motion Controller for Mac / PC (3D motion controller, updated software) (Accessories) Sensor cheap but not very accurateSkynet - DHT11 - Temperature and Humidity Sensor Module for Arduino DHT11 - Raspberry (Electronics) The difference with the normal Wii Remote Plus is the integrated sensor which measures accurateNintendo Wii U / Wii - Remote Plus, black (Accessories) Garmin's new bike cadence sensor: light, easily, ingeniously simple! ANT + radio. No magnet, no adjustment necessary.Garmin Bike Cadence sensor 010-12102-00 (Electronics) Simple, practical sensor, a steal4-Pin Module HC-SR04 ultrasonic distance measurement transducer Sensor for Arduino (Electronics) A good fitness bracelet and excellent HR sensorMio Fuse Performance Activity Tracker, Crimson, L (Equipment) The light sensor promptly packed into the bathroom when K ***** I get it now on every timeTaoTronics 6 LED Solar Night Light with Motion Detection (900 mAh battery, 3 m sensor range, 12 hours battery life) Ideal all-round lens for cameras with APS-C sensorSigma 17-70 mm lens f2,8-4,0 (DC Macro OS HSM, 72mm filter thread) for Canon lens mount (Electronics) Simple, accurate and reliableUNIVERSAL THERMOSTAT UT 200 (Misc.) Super clock with very accurate GPSPolar, Polar V800 Black Grey HR (equipment) Lots of potential, but large sensor calibration and reliability problemsNetatmo Weather Station for Smartphone (Electronics) Solid, complete and accurateOmron - BF 511 - turquoise Impedancemeter Balance (Health and Beauty) Very Readable Very Accurate!Wetterladen 30.3036.01.IT Easy One radio Thermometer (Garden)