Shop OBEX P1 Docs P2 Docs Learn Events
Rear Bumping Whiskers- — Parallax Forums

Rear Bumping Whiskers-

H_manH_man Posts: 6
edited 2005-10-22 06:58 in BASIC Stamp
I have a robot with 4 whiskers two on the front and two on the back that work by creating a circuit once they touch the sides of the bracket.· I'm using the BSIIE and am using the PBAsic programming language.· I have a simple program that drives until it detects something, then reverses in the opposite direction.· I'm trying though, to find out HOW I can implement the rear whiskers to stop the unit and go forward again.· Whenever I put that line of code just like the front whiskers on the main event loop·(highlvl) it does nothing.· My question is, where should I put the IFIN2=0 then goforward·line to get it to go forwardwhen it hits something while it's backing up.· I tried a couple weeks ago in numerous places but I though you guys could help me.

Post Edited (H_man) : 10/10/2005 11:13:39 PM GMT

Comments

  • metron9metron9 Posts: 1,100
    edited 2005-10-22 06:58
    Would you not just make a right and left back wisker subroutines?
    
    lBACKwhisker:
      GOSUB drives      'stop drive motor.
      GOSUB soundb      'Bad sound.
      GOSUB steerl      'Wheels RIGHT
      distance=25
      direction=1        'Forward.
      GOSUB drivew
      IF IN2=1 THEN lwhisker1    'Left Back Whisker stuck?
      GOSUB problem
    lBACKwhisker1:
      GOSUB steerc      'Wheels straight.
      distance=65000      'Drive for a long time.
      direction=1
      GOSUB drive
      RETURN
    
    
    
Sign In or Register to comment.