Make your first project with an arduino UNO or any arduino, and a range finder sensor

Step 1: Make Sure You've Got Everything!

Your gunna need- 4 jumper wires 1 arduino ( I used UNO) 1 breadboard 1 data cable to program the arduino 1 hc-sro4 sensor
<p>Thanks supah,</p><p>Minor outputting improvement can be had with:</p><p>Serial.print(distance);</p><p>Serial.println(&quot; cm&quot;);</p>
<p>#define trigPin 3</p><p>#define echoPin 2</p><p>void setup()</p><p>{</p><p>Serial.begin(9600);</p><p>pinMode(trigPin, OUTPUT);</p><p>pinMode(echoPin, INPUT);</p><p>}</p><p>void loop()</p><p>{</p><p>int duration, distance;</p><p>digitalWrite(trigPin, HIGH);</p><p>delayMicroseconds(2000);</p><p>digitalWrite(trigPin, LOW);</p><p>duration = pulseIn(echoPin, HIGH);</p><p>distance = (duration/2) / 29.1;</p><p>Serial.println(distance);</p><p>Serial.print(&quot;cm&quot;);</p><p>delay(500);</p><p>}</p>
<p>Nice, simple, very well done.</p>
<p>Excellent basic tutorial, it helped me set mine up with a minimum of problems. </p>

About This Instructable




More by technoguy123:Arduino Range Finder Tutorial 
Add instructable to: