![Wave complete 9](https://cdn1.cdnme.se/5447227/9-3/14_64e61dfbddf2b36505b4c7c8.png)
begin( 9600) // Starts the serial communication PinMode(trigPin, OUTPUT) // Sets the trigPin as an Output pinMode(echoPin, INPUT) // Sets the echoPin as an Input Serial. */ // defines pins numbers const int trigPin = 9
![wave complete 9 wave complete 9](https://1.bp.blogspot.com/-qhptJK1mJl8/XqiXCkSqbZI/AAAAAAAAA6M/0s1_AA7adNYfqvEuw72jyfQWLWZGKl8XQCLcBGAsYHQ/s1600/RPJH2Q8.jpg)
Ultrasonic Sensor HC-SR04 and Arduino Tutorial Here’s a code for measuring distance using the HC-SR04 ultrasonic sensor and Arduino. As an Amazon Associate I earn from qualifying purchases. Breadboard and Jump Wires ……… Amazon / Banggood / AliExpressĭisclosure: These are affiliate links.Arduino Board …………………………… Amazon / Banggood / AliExpress.Ultrasonic Sensor HC-SR04 ………… Amazon / Banggood / AliExpress.You can get these components need for this tutorial from any of the sites below:
![wave complete 9 wave complete 9](https://http2.mlstatic.com/waves-complete-992-2018-para-mac-vst-aax-audio-units-D_NQ_NP_785949-MLM27439757989_052018-F.jpg)
![wave complete 9 wave complete 9](https://static.independent.co.uk/2022/02/17/14/hamburgferry.jpg)
The Ground and the VCC pins of the module needs to be connected to the Ground and the 5 volts pins on the Arduino Board respectively and the trig and echo pins to any Digital I/O pin on the Arduino Board.
![Wave complete 9](https://cdn1.cdnme.se/5447227/9-3/14_64e61dfbddf2b36505b4c7c8.png)