Add the following snippet to your HTML:<iframe frameborder='0' height='385' scrolling='no' src='https://www.hackster.io/abiodun1991/the-application-hc-sr04-ultrasonic-sensor-1ee84a/embed' width='350'></iframe>
How HC-SR04 Ultrasonic Sensor Works & Interface It With Arduino
Read up about this project on
#include <HCSR04.h> int triggerPin = 9; int echoPin = 12; void setup () { Serial.begin(9600); HCSR04.begin(triggerPin, echoPin); } void loop () { double* distances = HCSR04.measureDistanceCm(); Serial.print("1: "); Serial.print(distances[0]); Serial.println("cm"); Serial.println("---"); delay(500); }
Please log in or sign up to comment.
Comments
Please log in or sign up to comment.