dim A as new oCountdown
Sub Main()
A.Output.Link( switch1)
A.PreScale = 59
A.ClockIn.Link(ooPIC.Hz60)
A.Operate = 1
switch1.IOGroup = 3
switch1.Direction = cvOutput
A.Output.Link( switch2)
A.PreScale = 59
A.ClockIn.Link(ooPIC.Hz60)
A.Operate = 1
switch2.IOGroup = 3
switch2.Direction = cvOutput
End Sub
Sub routerstate1_ Code()
switch1.state = cvOn
switch1 = 5
switch1.state = cvOff
switch2.state = cvOn
switch2 = 25
switch2.state = cvOff
switch1.state = cvOn
switch1 = 20
switch1.state = cvOff
This is kind of a long hypothetical code.... Is this the right way to use this object?
Carson
ooPIC Tech Support <dennis.clark@oopic.com> wrote: See below:
carson hoyt wrote:
> Let me see if I understand what you're saying,
>
> "The new oButton objects will allow you to debounce the buttons as well which will make everything work better. Remember that an event will fire when the
> Operate line moves from '0' to '1', it won't fire again until it moves
> back to '0'."
> If I use the obutton object instead of a oDio1, every time I hit the button the oEvent will restart from the begining of the event code? This would actually be very good if this was the case.
>
> Second debounce will in effect return the button to 0 after it has been pressed?
Debounce will make sure the transition takes place. With a regular
"on/off" button this means that the press will register as it is
debounced, you won't return to the default case until your finger
releases the button. oButton will debounce the transition, that is both
the "down" and the "up".
> "I'm not a fan of using ooPIC.delay in anything."
>
> Is this because the oopic will not be able to monitor the other buttons while it is delaying? I actually only need one event to funtion at a time, so that aspect isn't really a problem, not being able to sense incoming event triggers is though. I would experiment with this but I recently burnt out my oopic chip with a improperly designed circuit (forgot the diodes, ha,ha) and am currently waiting for a new chip.
Yes. The ooPIC essentially "freezes" while the .delay is in effect.
> "I would have a function that is periodically called that checks against a timer
> so that processing can go on while something is awaiting a timeout. One
> way to do that is to create a VC (virtual circuit) that is triggered by
> the button press such that it will start a timer that will call an event
> to shut a switch off when it times out. oCountdown is a good candidate
> for that."
>
> Hmmm after looking at the object page for oCountdown I'm not sure that this is what I need. The reason I was using oopic delay was that I needed a way to say wait x amount of time (where x could be any amount of time) before the next step in the oEvent. I feel like I am probably using the wrong words to say something very simple.
> The purpose of this program is to trigger beable to trigger an oEvent and have it function as a piece of procedural programing code within a larger object oriented event-based programing code. Maybe you could give me an example that would have the same effect?
Look again. oCountdown will start at the value you have it set to and
at every clock transition it will decrement until zero, then a flag will
be set that can trigger another event. The countdown rate can be set by
the frequency of the trigger clock you use. oHz1 and oHz60 are simple
to use clocks, oClock can provide another one. There is a lot of
flexibility here. The best part is that this VC can run in the
background without blocking other button presses or anything else that
is currently running. You have two buttons? No problem, define another
VC to handle the other button.
> Thanks for the help I've certainly learned a lot in a short time.
Sure! Have fun,
DLC
> Carson
>
>
>
>
>
>
> ---------------------------------
> Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Yahoo! Groups Links
>
>
>
--
------------------------------------------------------
Dennis Clark ooPIC Tech Support
www.oopic.com
------------------------------------------------------
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment