Shop OBEX P1 Docs P2 Docs Learn Events
Loop question — Parallax Forums

Loop question

nshoemanshoema Posts: 6
edited 2014-02-09 17:17 in BASIC Stamp
Hey eveyone, I finally got my Homework board working with a rechargeable battery. I am using the Mac BASIC Stamp editor and I noticed whenever I try use a DO LOOP statement, the editor doesn't highlight or recognize it, it only recognizes FOR NEXT and IF THEN but not ENDIF ELSEIF ELSE or DO LOOP? I never had that issue on my BS1?

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-01-30 01:05
    nshoema wrote: »
    I never had that issue on my BS1?

    Really? Those are not supported statements on the BS1. You need to use a BS2 (any kind) to use DO, LOOP etc.
  • ercoerco Posts: 20,256
    edited 2014-01-30 03:18
    +1 to Duane's comment on BS1.

    I don't use the Mac Editor for BS2 programming. Did you specify/click PBASIC 2.5? PBASIC 2.0 does not support DO loops, ENDIF, ELSE or ELSEIF statements.
  • nshoemanshoema Posts: 6
    edited 2014-01-30 18:23
    Yeah, I use the '{$PBASIC 2.5} directive in all of my code and none of those looping statements get highlighted, only IF THEN and FOR NEXT?
  • Mike GreenMike Green Posts: 23,101
    edited 2014-01-30 19:16
    You'll have to attach your program to a posting (don't cut and paste it ... use the Go Advanced button to bring up the attachment manager). I've used the Mac editor for BS2 programming and I've never seen what you describe. The Mac editor doesn't support the BS1.
  • nshoemanshoema Posts: 6
    edited 2014-01-30 21:11
    To clarify, I have the BS2 homework board. So Mike Green, you know how when you type a keyword function like VAR BYTE, it automatically highlights blue? Take this simple code to control an LED for instance. Every function gets highlighted blue except the DO/LOOP construct?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2014-02-01 07:06
    nshoema wrote: »
    when you type a keyword function like VAR BYTE, it automatically highlights blue? Take this simple code to control an LED for instance. Every function gets highlighted blue except the DO/LOOP construct?

    DO and LOOP highlight blue for me.
    The programme compiles and runs.
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    
    DEBUG "The LED conn'd to Pin 14 blinks!"
    
    DO
     HIGH 14
     PAUSE 500
     LOW 14
     PAUSE 500
     LOOP
    
  • PublisonPublison Posts: 12,366
    edited 2014-02-01 08:52
    Highlights are all good for me, Windows 7.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-02-08 17:02
    Ditto: All good. Windows 7 Pro.
  • Mike GreenMike Green Posts: 23,101
    edited 2014-02-08 18:52
    Under MacBS2, the DO and LOOP do not highlight, but it seems to compile ok. I suspect there's a bug in the highlighting, but the DO LOOP executes as expected. Send a message to Murat about the MacBS2 highlighting.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2014-02-08 20:15
    Hmmm, MacBS2 highlights those keywords okay for me. However, I'm running MacBS2 version 2.1b4 on system 10.6.8 snow leopard, not the new beta version 3 that works Mac OSX lion.
  • TBGuyTBGuy Posts: 2
    edited 2014-02-09 09:36
    I'm new to this forum and unsure if I should start a new thread, but here are my comments...
    I too am having a problem with the DO, LOOP statements. Although I'm on a Windows Vista OS. Just as mentioned above the DO and LOOP are not highlighted and the program does not loop - but does run through one time and stops. I'm using a BS2 and PBASIC 2.5. Any ideas?
  • Mike GreenMike Green Posts: 23,101
    edited 2014-02-09 15:18
    The Windows version does not have the same highlighting issues as the Mac version and what you describe should work (and has worked for others) using the Windows Stamp Editor. If it doesn't work, you might have something wrong with your directives. Post a source file that doesn't work and post it using the Attachment Manager that you get with the Go Advanced button. Don't just paste it into a posting.
  • TBGuyTBGuy Posts: 2
    edited 2014-02-09 16:11
    Thanks for the comment. I'm on the learning curve of the BS2. You mentioned 'directives' so I went to the editor and selected version 2.5 and now all works well. Thanks again for the great hint.
  • ercoerco Posts: 20,256
    edited 2014-02-09 17:17
    @TBguy: My main computer ran Vista until just recently when it got Win8 (OK, laugh everyone, from bad to worse). The PBasic editor always worked perfectly, so I suspected some detail was missing from your post. Happy to hear you got it all sorted out.
Sign In or Register to comment.