Shop OBEX P1 Docs P2 Docs Learn Events
How Ping))) Works — Parallax Forums

How Ping))) Works

tmd13tmd13 Posts: 16
edited 2009-02-04 00:08 in BASIC Stamp
This might be something really easy for some of you but I'm confused with the coding part for the ping)) sensor.
Can you please tell me where these values come from:
Where the 5 and 1 come from, what are those values, I got this info from the ping)) pdf file from parallax. This is a example program. I know that 15 is the pin that the ultrasound is connected to.

But what about 5 and 1?????????????
DO
PULSOUT 15, 5
PULSIN 15, 1, time
cmDistance = cmConstant ** time
inDistance = inConstant ** time
............
loop

I will really appreciate your help. Thanks in advance.

Comments

  • JonathanJonathan Posts: 1,023
    edited 2009-02-03 23:27
    TMD13,

    In the pulsout command, the 5 is the length of the pulse. Look at the command in the manual.

    In the pulsin statement, the 1 is the start condition of the pulse. Look at the command in the manual.

    Make sure to note that the length of the pulsout depends on which flavor of Stamp you are using.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • tmd13tmd13 Posts: 16
    edited 2009-02-03 23:32
    I'm using a basic stamp 2, The boe bot platform.

    So what difference is gonna make if I change those values.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-03 23:46
    It might not work depending on what values you change and what you change them to. Read the documentation for the PING))) to see what it requires and read the documentation for the PULSOUT and PULSIN statements to see what those parameters are used for.
  • JonathanJonathan Posts: 1,023
    edited 2009-02-03 23:46
    Read the manual. It explains the commands in detail. Come back you have questions after that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • tmd13tmd13 Posts: 16
    edited 2009-02-04 00:08
    Thank you so much for your help, it really helped me a lot, I went through another manual and found what you were mentioning before.

    Thannks men.
Sign In or Register to comment.