NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » HC-SR04 ultrasonic distance sensor NerdKits coding

March 30, 2012
by victor
victor's Avatar

I've got the HC-SR04 ultrasonic distance sensor. I looked up online but was only able to find those Arduino tutorials to make it work. Here is one example.

I'm wondering how to implement this particular function which is available in Arduino ? Basically it's measuring the duration that input pin voltage changes from high to low (vice visa), to calculate the distance (d = v*t/2).

    //get the time to receive rebound
    duration = pulseIn(us_echoPin, HIGH);
March 30, 2012
by pcbolt
pcbolt's Avatar

Hi victor -

Here is a forum thread lukel started to help him with a distance sensor. Hope it helps.

Post a Reply

Please log in to post a reply.

Did you know that you can see each keypress on a computer keyboard on an oscilloscope? Learn more...