Shop OBEX P1 Docs P2 Docs Learn Events
Help with ping sensor — Parallax Forums

Help with ping sensor

RobeRobe Posts: 13
edited 2005-08-03 21:09 in BASIC Stamp
I am trying to run four pings, with my bobat for navegation but
my servos speeds·slow down.· from full speed to slow
could it be batery pawer or code.· if i use only two ping runs ok
all pings are conected to BS2 .
······················ could anyone helpme,·I appreceate the help.


·
·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-20 21:16
    The Ping adds delays that may be upsetting your program. Instead of "Pinging" all of them in the same cycle, you might consider doing it in a round-robin fashion so that you don't have to wait so long between updates.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • RobeRobe Posts: 13
    edited 2005-07-20 21:30
    Thank you Jhon.
    when you say round robin fashion how do i do that.
    ·
  • RobeRobe Posts: 13
    edited 2005-07-20 21:59
    Jhon , also on 6/21/05

    you send me a image to knock off half a volt fron a 1.5 surce
    for a pir sensor

    a 10K resistor coming from the PIR sensor to the BS2 then in line another resistor 4.7K
    i think it's end is conected to groun is it. but coneted to the PIR ground or the BS2 I not shure
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-20 22:04
    Each time you go through the main loop you point at a different sensor.· If you're using four, you can do this:

    · pingNum = pingNum + 1 // 4

    This will keep the value of "pingNum" between 0 and 3.· If you wire your sensors to continguous pins you can call the first PingBase and then do something like this:

    Get_Sonar:
    · thePing = PingBase + pingNum
    · LOW·thePing
    · PULSOUT thePing, Trigger
    · PULSIN· thePing, IsHigh, rawDist(pingNum)
    · rawDist(pingNum) = rawDist(pingNum) */ Scale
    · rawDist(pingNum) = rawDist(pingNum) / 2
    · RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2005-07-25 00:48
    Jon ( or some else )

    " If you wire your sensors to continguous pins you can call the first
    ( PingBase ) and then do something like this:"
    (Is this where you would put " PingBase" pin and # or is it "ThePing" pin #)

    Thank You for all of your help in this matter

    samsam
  • ManuelManuel Posts: 105
    edited 2005-08-03 18:45
    I want to use this forum only because its alredy done and it tals about the sonar. I have the new sonar with only 1 to pin connection. Is it possible to meassure with decimals by using hundreds?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Best Regards

    Manuel C. Reinhard
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-03 19:44
    You can, but the device accuracy is not enough to warrant converting to 100ths.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • ManuelManuel Posts: 105
    edited 2005-08-03 19:47
    But i could have 10´s then, right?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Best Regards

    Manuel C. Reinhard
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-03 21:09
    You can use any resolution you want, but the accuracy of small sonars like that don't justify anything better than 1 cm.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.