Shop OBEX P1 Docs P2 Docs Learn Events
No Subject — Parallax Forums

No Subject

JerryShawJerryShaw Posts: 1
edited 2009-12-28 17:09 in BASIC Stamp
I'm sure this question has been asked, but there are so many responses in the search that it'd be near impossible to find the answer.

I just got started with the HomeWork board (BS2, PBASIC 2.5) and I am loving it. One annoying thing, however, is that in order to stop a program from running, I must either:

-Unplug the battery (but the program runs again when I plug it back in)

or

-Run a program with just the END command.

The reset button only starts the program over. For looping programs, this is not ideal. Is there a way to just "turn off" a running program without unplugging the power source?

Post Edited (JerryShaw) : 12/28/2009 2:09:10 PM GMT

Comments

  • davejamesdavejames Posts: 4,047
    edited 2009-12-28 16:32
    ...shooting from the hip...

    How about modifying the program to run when a particular pin is 'high' and stop running when that pin is 'low'? The pin could be forced high by connecting it to +5V through a 10K resistor, and forced low by connecting it to 0V (ground) through the same resistor. The pin would have to be set as "input" for this to work properly. The connection could be made by moving a wire or by an SPDT switch.

    Regards,

    DJ

    P.S. I would suggest that you edit your original post and give the thread a subject.· That helps others in deciding whether to read the thread or not.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-28 17:09
    The short answer is "no". Whatever program is installed in the Stamp will start when the power goes on or when you press the reset button when it's already on and it will stop when the power goes off. As you've noticed, you can download a new program to the Stamp and the download process will force a reset.

    As davejames mentioned, you can write your program so it requires a switch to be set for the rest of the program to be executed. If you're always going to have your board connected to your PC, you can add a DEBUGIN statement to the beginning of your program to require a character or number to be sent from the PC, like a "G" for "go" or a number to indicate what function to perform. It helps to use a DEBUG statement with the DEBUGIN statement so you can tell what the Stamp program is doing ... a prompt for the character or number.
Sign In or Register to comment.