Reads the echoPin, returns the sound wave travel time in microseconds Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH) Clears the trigPin digitalWrite(trigPin, LOW) 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 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |