hcsr04 custom example by Theomachist

Cloned from Sketch hcsr04 example by erolbuyukcinar

This sketch is missing a short description
Utilizing a 4 pin Ultrasonic sensor, this code measures the distance from the face of either emitter to a solid surface. Great distances (excess of 400cm) are difficult to reliably measure after acoustic diffusion, so those are ignored as being out of range. In addition to the ultrasonic sensor, this code uses 2 or 3 leds of any color. The Leds are connected to digital pins 5, 6, & 7, and may be moved to any other digital pin at your discretion. The Leds on pins 5 & 7 are used to indicate a set parameter of distance as reported by the ultrasonic sensor. Pin 7 activates when the distance is below a set threshold, while pin 5 activates when the distance exceeds the threshold. Pin 6 is in excess of the sensor, used simply as a timing indicator. It is set to activate the led for 1 second out of every 10 seconds, behaving as an indicator of the passage of time.

Embed This Sketch

Use the following HTML code to embed the sketch code above in your blog or website.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:126374" frameborder="0"></iframe>

Embed The Serial Monitor

You can also embed the Serial Monitor section! Just use this HTML code.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe>