Shop OBEX P1 Docs P2 Docs Learn Events
pause commands — Parallax Forums

pause commands

tweektweek Posts: 14
edited 2008-01-25 16:23 in BASIC Stamp
Hello all,.. Im still new to stamps, and trying to figure things out. I understand the pause command, but that it also has a "max" time you can set.(not to exceed 16 bits).·Is it possible to keep running a pause command over and over, so it can pause anywhere from 1 to 15 minutes? Not randomly though,·over the duration of maybe an hour, before looping back to the beginning?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 06:23
    You can repeat a PAUSE statement as you would repeat any statement. For example, you could use a FOR / NEXT loop to pause for some specified number of minutes as follows (where i is defined as a byte or word variable):
    for i =1 to timeInMinutes
       pause 60000
    next
    


    Alternatively, you could wait for some time in seconds:
    for i = 1 to timeInSeconds
       pause 1000
    next
    
  • tweektweek Posts: 14
    edited 2008-01-25 06:39
    Thanks Mike,
    I was just thanking you in a post to a question about ways to destroy a stamp....So I could possibly indefinetely pause a program, without the stamp running out of memory, because it will loop on that command, for x amount of minutes, before its next function?
    Is that correct?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 06:50
    Your question tells me that you may not understand basic programming yet. The idea of a loop as a way to repeat some action is a very basic one. There is a lot of basic tutorial information for the Stamp that you should look at and all of it is downloadable from Parallax's website (the Resources / Downloads section) for free. "What's a Microcontroller?" is a good starting point. If you have your Stamp already, you should work through the various examples in the tutorial, one at a time. Don't just read them, do them so you can experience what the programs actually do. Where there are exercises, try them. You'll learn more and learn better by doing them.
  • tweektweek Posts: 14
    edited 2008-01-25 07:04
    I guess your right. Ive been working through the book,but sometimes get ahead of myself... all I really understand is SIMPLE..pause, freqout, hi/low, comands. I'll hit the book more, and come back with an intelligent question. [noparse]:)[/noparse] Thanks Mike
  • Larry~Larry~ Posts: 242
    edited 2008-01-25 15:20
    Not to get off subject but the Sleep command will do the same thing. Just incase you are using battery power, it will go into low power mode and save some juce.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 16:23
    The SLEEP and NAP commands do have a problem that they periodically turn off any outputs (make them inputs) briefly before turning them back on again. It's an artifact of how they do low power mode. You can design output circuitry to allow for this. If you don't you can get bizarre system behavior sometimes.
Sign In or Register to comment.