Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Stamp Code — Parallax Forums

BS2 Stamp Code

ur5pointos2slour5pointos2slo Posts: 19
edited 2008-11-14 03:06 in BASIC Stamp
I still am trying to get both IR headlights and QTI sensors to work together. I have an updated code that I will attach. I have no experience with programming so I am having a hard time understanding how to write the code. I have tried·a dozen ways. Could someone please look at this code and give me details of how I could arrange this to work. It will follow the line but I want the headlights to work at the same time. Thanks

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-11-13 21:21
    The reason why it only follows the line is because of the loop that you have on line 90. This loop cannot exit, so it gets 'stuck' in there. What you want is a main method like below (psuedo code):

    Main

    Check IR
    Check Line
    Decide what to do
    Do it

    GOTO main


    This is an implicit loop, and does all the primary functions in order. Take a look at the books "What's a Microcontroller", "Robotics with the BoeBot", and "Basic Stamp Syntax and Reference Manual" for general programming principles. They are all available for free download from Parallax.
  • ur5pointos2slour5pointos2slo Posts: 19
    edited 2008-11-14 03:06
    SRLM said...
    The reason why it only follows the line is because of the loop that you have on line 90. This loop cannot exit, so it gets 'stuck' in there. What you want is a main method like below (psuedo code):

    Main

    Check IR
    Check Line
    Decide what to do
    Do it

    GOTO main


    This is an implicit loop, and does all the primary functions in order. Take a look at the books "What's a Microcontroller", "Robotics with the BoeBot", and "Basic Stamp Syntax and Reference Manual" for general programming principles. They are all available for free download from Parallax.
    ·What exactly do you mean by "check IR"? How would I express that in "code" terms. Would it be possible to use the QTI Sensor Code for the
    "Main" and let one of the cases have a GOSUB routine to call up the IR sensors? Just an idea. ·
Sign In or Register to comment.