Shop OBEX P1 Docs P2 Docs Learn Events
Ultrasonic distance measurement( 28015) and Parallax (P8X32A-D40) microcontroller — Parallax Forums

Ultrasonic distance measurement( 28015) and Parallax (P8X32A-D40) microcontroller

Hello

I am trying to measure the distance of human body using Ultrasonic distance measurement( 28015) and Parallax (P8X32A-D40) microcontroller. Also, I am using SimpleIDE software to program the microcontroller. I need the ultrasonic to start triggering from 3 feet and I need a pulse counter to make sure I output only 0-1 V. But I have no idea how to write the codes or how start, So can please someone help me with that??

Comments

  • Have you checked the Parallax Learn site, as probably there's some code samples or ideas over there. Search for "PING"

    https://learn.parallax.com

  • Try this one

  • /*
    Test Ping Distance.c

    Measure and display Ping))) Ultrasonic Distance Sensor distance measurements.
    */

    #include "simpletools.h" // Include simpletools header
    #include "ping.h" // Include ping header

    int main() // Main function
    {
    while(1) // Repeat indefinitely
    {
    int cmDist = ping_cm(15); // Get cm distance from Ping)))
    print("cmDist = %d\n", cmDist); // Display distance
    pause(200); // Wait 1/5 second
    }
    }
Sign In or Register to comment.