Shop OBEX P1 Docs P2 Docs Learn Events
having issues with subroutine commands. . . . . — Parallax Forums

having issues with subroutine commands. . . . .

thefitz85thefitz85 Posts: 16
edited 2009-04-11 22:52 in BASIC Stamp
i have attached a copy of my code for reference. the program is for simple obstacle avoidance. the serout 16 commands are the instructions for my motor controller amplifier. i am using a household universal remote with a seperate device to initiate the bots movement, and to stop the bot. the problem that i am having is when i initialize the bot movement the program jumps to the proper subroutine (obstacle_avoidance), however from that point it is not running through the if then statements in the obstacle_avoidance subroutine. i am unsure why it wont begin the if then statements, which as you can see from the code would then initialize other subroutines (back_up, turn_left, turn_right, and forward_pulse). am i missing some return command or do-loop statement? any help would be greatly appreciated. thanks matthew fitzgerald

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-04-11 15:23
    Your if button THEN do something) is a GOTO not a gosub so there is no expectation of a return change line to if "something happens" then gosub 'subroutine"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • thefitz85thefitz85 Posts: 16
    edited 2009-04-11 22:52
    i tried referencing: THEN GOSUB. . . . .but that did not work either. . . .if i *** a o loop function around the obstacle avoidance subroutine then the sensors work properly, however than i cannot stop the obstacle avoidance
Sign In or Register to comment.