Shop OBEX P1 Docs P2 Docs Learn Events
Prallax newbe programming problems — Parallax Forums

Prallax newbe programming problems

the_0utsider1the_0utsider1 Posts: 13
edited 2011-09-18 21:06 in General Discussion
I am trying to program a 2P 24 pin.

I have a program that would use gosub 50 times to call 1 of 3 subroutines frequently.
When debugging it reports "expected a label".
This is what i have:

gosub eject

.
.
.
.
eject:

If i read the doc correctly, i can only use gosub a few times. What can i substitute gosub with so as to run the subroutine and return to the same place in the program?



another problem i have - Can i put a "Do Loop while" inside another "do loop while" the program errored out with this.

lastly, if i do a if then,

if x=0
then
echo 1
echo 2
else
echo 3
if then only applies to the line echo1. it will read echo 2 every time. How do i get it to run everything if x=0??

Is there a website where people post code??

TIA

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-18 21:06
    There is a maximum of 255 GOSUBs per program. If you get an "expected a label" message with fewer than that, you may have mis-spelled the label.

    The IF statement is IF <expression THEN, so you'd write:
    IF x = 0 THEN
      echo 1
      echo 2
    ELSE
      echo 3
    ENDIF
    

    Remember to use the [ code ] and [ /code ] brackets as described here:


    attachment.php?attachmentid=78421&d=1297987572

    In the future, most postings that have to do with the Basic Stamps are posted in the Basic Stamp forum here. Each of the forums has a description of the main purpose of the forum. Read those for details.
Sign In or Register to comment.