I have a question regarding subroutines. The code that I have attached will run for 10 iterations perfectly then I fet the following error:
"Subroutine call overflow/underflow"
If I delete the subroutine, the code works fine. Obviously I am not understanding something about the subroutine command. Could you please enlighten me?
Thanks, Gus Steinmetz
The problem you’re running into is that once your main loop completes, your program isn’t ending; it’s continuing past the “repeat” into the subroutine. When it reaches the last “return”, there’s nothing to return to, so that causes the “Subroutine call overflow/underflow” error. To fix this, all you need to do is add a “quit” instruction immediately after “repeat”.
Thank you Kevin, that worked perfectly. I’m new to this so I didn’t know about the quit command. The program seems to quit itself if there is no subroutine involved so that confused me.