Shop OBEX P1 Docs P2 Docs Learn Events
Program won’t loop — Parallax Forums

Program won’t loop

navyguy0521navyguy0521 Posts: 7
edited 2021-10-16 01:40 in BASIC Stamp

Hi,
Just signed up for this forum.
Getting back into my parallax basic stamp and my simple program won’t loop.

I’m simply energizing and de energizing a few
5 vdc relays.
Program Just goes through once. I know this is really simple to fix. I’m simply not doing it right.
I can’t post my program from my phone but hoping someone can just help me with an example for looping it.

Thanks so much!

Comments

  • Welcome to the forums!
    People in these forums might not know what a Sketch is. We call them Programs. Would suggest changing the title and post your code when you get a chance,

  • JonnyMacJonnyMac Posts: 9,158
    edited 2021-10-15 21:31

    The Arduino made the term "sketch" popular, because the Arduino IDE was derived from the Processing IDE that was created for artists. The creators of Processing wanted artists to be able to sketch in code the way the can with pencils or paint, hence they refer to Processing programs as sketches.

    @navyguy0521 Make sure you have some kind of looping mechanism built into your code. The Arduino hides a lot of details, hence this code:

    void loop()
    {
      // loop code
    }
    

    ...actually gets converted to something like this behind the scenes:

    void loop()
    {
      do while (true) {
        // loop code
      }
    }
    

    There are two BASIC Stamp families, but GOTO will work in both. You might bundle your code in something like this:

    Main:
      ' loop code
      GOTO Main
    
  • Thank you so much for the great explanation!
    I’ve used arduino but I like parallax more.
    Just seems easier for me.

    @JonnyMac said:

    The Arduino made the term "sketch" popular, because the Arduino IDE was derived from the Processing IDE that was created for artists. The creators of Processing wanted artists to be able to sketch in code the way the can with pencils or paint, hence they refer to Processing programs as sketches.

    @navyguy0521 Make sure you have some kind of looping mechanism built into your code. The Arduino hides a lot of details, hence this code:

    void loop()
    {
      // loop code
    }
    

    ...actually gets converted to something like this behind the scenes:

    void loop()
    {
      do while (true) {
        // loop code
      }
    }
    

    There are two BASIC Stamp families, but GOTO will work in both. You might bundle your code in something like this:

    Main:
      ' loop code
      GOTO Main
    
  • @Publison said:
    Welcome to the forums!
    People in these forums might not know what a Sketch is. We call them Programs. Would suggest changing the title and post your code when you get a chance,

    @Publison said:
    Welcome to the forums!
    People in these forums might not know what a Sketch is. We call them Programs. Would suggest changing the title and post your code when you get a chance,

  • @navyguy0521 said:

    @Publison said:
    Welcome to the forums!
    People in these forums might not know what a Sketch is. We call them Programs. Would suggest changing the title and post your code when you get a chance,

    @Publison said:
    Welcome to the forums!
    People in these forums might not know what a Sketch is. We call them Programs. Would suggest changing the title and post your code when you get a chance,

    Hi. Thanks. Will do.
    Trying to keep all the lingo straight between the two.
    I got sternly corrected when I called the arduino sketch a program. Lol

  • Sorry but your example doesn’t work.
    When I hit “run” it says “expected label”

    Unfortunately, I’m still so green at this that I’ll type in word for word what I’m given.

    @JonnyMac said:
    The Arduino made the term "sketch" popular, because the Arduino IDE was derived from the Processing IDE that was created for artists. The creators of Processing wanted artists to be able to sketch in code the way the can with pencils or paint, hence they refer to Processing programs as sketches.

    @navyguy0521 Make sure you have some kind of looping mechanism built into your code. The Arduino hides a lot of details, hence this code:

    void loop()
    {
      // loop code
    }
    

    ...actually gets converted to something like this behind the scenes:

    void loop()
    {
      do while (true) {
        // loop code
      }
    }
    

    There are two BASIC Stamp families, but GOTO will work in both. You might bundle your code in something like this:

    Main:
      ' loop code
      GOTO Main
    
  • Sorry but your example doesn’t work.
    When I hit “run” it says “expected label”
    Unfortunately, I’m still so green at this that I’ll type in word for word what I’m given.

    I don't think you did. I think you left of the color at the end of Main: -- this is how PBASIC defines a label.

    BS1:

    BS2:

    I've attached BS1 and BS2 templates for you to start with.

Sign In or Register to comment.