Shop OBEX P1 Docs P2 Docs Learn Events
Code question here! — Parallax Forums

Code question here!

legodudelegodude Posts: 2
edited 2009-03-09 17:30 in Robotics
Ive been teaching myself in writing code for the basic stamp 2 or BS2 module.My question how do you loop a program over and over.I would enter loop at the end of a program it does not do what I want it to.I basically want the program to run over and over till I want it to stop,by hitting reset or simply by turning it off.PS the bs2 is on a BOE board.Any help would be great.yeah.gif

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-08 04:00
    Have you looked at the "What's a Microcontroller?" tutorial? It's a good introduction to programming the Stamps.

    Look in the BASIC Stamp Syntax and Reference Manual for examples and descriptions of labels, the GOTO statement and the DO / LOOP statement.
  • legodudelegodude Posts: 2
    edited 2009-03-08 18:48
    Hello, I tried a "GOTO" command and that did the trick.
    Thanks for the help!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-03-09 17:30
    Well you haven’t posted any code…but a good guess on what could be affecting you is that when code is first run the variables have been initialized to 0. However, if you simply GOTO the beginning of the code without initializing them, they may affect the way your program runs. This is a common mistake for beginners. As Mike points out, the WAM text will certainly help you on your learning curve. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.