Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp timer — Parallax Forums

basic stamp timer

amuszemeamuszeme Posts: 13
edited 2006-04-25 01:51 in BASIC Stamp
can the bs2 be programmed to follow a loop for a certain number of seconds/minutes and then fall out of the loop when the timer reaches its count?

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-24 01:07
    Basically, I want to say, emphatically, "Yes, you can," but right after doing so you're going to drop the other shoe and change all that.· So, what's up Doc?· What's the big(ger) picture?· More details, please.
  • amuszemeamuszeme Posts: 13
    edited 2006-04-24 01:22
    That's it...all i want to do is make a loop that will allow me to run a servo for a certain amount of time and I just need to know how to do it. I have a boe-bot that I need to operate for a certain time unless the reset button is pushed.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-24 01:32
    OK (you provided more info).· I'm not a real DO...LOOPer, but here's what I'd do:

    FOR A = 0 TO 2000
    IF INPUT = 1 THEN ZAP
    PAUSE 10
    A = A + 10
    NEXT
     
    ZAP:
     stops the servo
    

    You start the servo running before executing this routine.· It will run for about 2 seconds.· It checks for an INPUT every 10msec.· If it gets an INPUT then it goes to "ZAP" and turns off the servo.· If it runs to the end of A (2000), then it falls through to "ZAP".
  • amuszemeamuszeme Posts: 13
    edited 2006-04-24 01:37
    Thank you PJ...I will try it.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-24 01:39
    It's a pseudo-codey thing I did, for sure, but I figure you get my meaning.
  • amuszemeamuszeme Posts: 13
    edited 2006-04-24 01:48
    Yeah, I got you. I'm gonna try it and let you know how it works after I finish testing the entire program.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-24 02:09
    Since I run a servo from an oscillator with a variable PW· that I enable/disable (I do different things), looking at it closer, you should make the SERVO-kick part of the routine.· It'll recur within the refresh time.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-24 17:29
    For timing of a routine using the DS1302 see the following thread.· It relates to using the DS1302 as a countdown timer.

    http://forums.parallax.com/showthread.php?p=550292

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2006-04-25 00:42
    Hi EveryOne

    ································································· ·idea.gif

    Here is the DS1302 as a countdown timer and this the·routine that i used named

    DS1302_VCR_Camera2.bs2 in the Attachment below

    I also have this routine· DS1302_Camera_1.bs2 Attachment below

    I hope this helps you in what you want to do

    Sam

    ······································································ jumpin.gif
  • amuszemeamuszeme Posts: 13
    edited 2006-04-25 01:51
    Thank you Sam, Chris and everyone else. You have been a big help.
Sign In or Register to comment.