Shop OBEX P1 Docs P2 Docs Learn Events
sonar robot — Parallax Forums

sonar robot

smartgsmartg Posts: 26
edited 2008-07-06 19:45 in BASIC Stamp
hey. me again i know you must be thinking im repeating a topic i have already done.well i decided i dont want to buy the extra servo.i wanted my robot to see the obostacle then turn 90 dergrees to to the right or close to it.·and when i tried my program it would sometimes work then after a few turns it just started to turn as if something was there but nothing was. when my BOE was on 1 the ping sesor acted· fine ,i could tell by the led on it. now all does is turn. heres my program:

var··· word·· time
·strart:
·· pulsout x,500
·· pulsin x· time

·if time < x then forward
·if time> x· then right

· forward: pulsout 12,900
············· pulsout 13,600


· right:·····pulsout 12,900
············· pulsout 13,900·

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-07-06 06:40
    var    word   time
     strart:
       pulsout x,500
       pulsin x  time
     
     if time < x then forward 
     if time> x  then right
     
      forward: pulsout 12,900
                  pulsout 13,600
     
     
      right:     pulsout 12,900
                  pulsout 13,900 
    
    

    You don't have x defined and you are assigning it to a word and using it as a pin definition. Work further on your code. Do you have the downloads What is a microcontroller and the boebot download? If not get them, read them, understand them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • smartgsmartg Posts: 26
    edited 2008-07-06 14:43
    where it says pulsout and pulsin thats pin 15,and the if then commands are 500[noparse][[/noparse]top]499[noparse][[/noparse]bottom]also when i unplug my servo off pin 13 it acts ok,other servo pluged in but plug it back in it acts up again.also on the right: i have a delay in order to turn 90 degrees.i forgot what it was have not looked at it in a while.itried not having that but it would turn but once the ping got at an angle that it could see it went forward and crashed.
  • FranklinFranklin Posts: 4,747
    edited 2008-07-06 15:40
    It's best if you attach the actual code you are asking questions about. Then we don't waste time trying to debug something only to have the poster come back to say, "that's not what I really have and your time was not helpful" Please ATTACH (see the choices when you post a reply) your code. The code you did give is still wrong!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • smartgsmartg Posts: 26
    edited 2008-07-06 18:28
    ok i will get the exact code. this is not my computer so,you now. and i didnt know that option was there
    tell me whats wrong? did you mean to do what i want is wrong or i wrote this code wrong.
  • FranklinFranklin Posts: 4,747
    edited 2008-07-06 19:45
    You wrote the code wrong, get the downloads on the boebot, it has many code examples.
    www.parallax.com/Portals/0/Downloads/docs/books/edu/RoboticsV2_2.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.