Thursday, July 26, 2007

[oopic] Re: Simple OOpic logic(?)

Here's the code that doesn't work. The AND and Flip-Flop work
individually, but when put together the flip-flop output goes to the
state that should be triggered when iscabledown is high.

Dim motion as New oDio1
Dim isCableUp as New oDio1
Dim isCableDown as New oDio1
Dim cableDown as New oDio1

Dim FF As New oFlipFlop
Dim andGate As New oGate(2)

Sub Main()
Call init
andGate.Input1.Link(motion)
andGate.InvertIn1 = cvTrue
andGate.Input2.Link(isCableUp)
andGate.InvertIn2 = cvTrue
andGate.InvertOut = cvTrue
andGate.Operate = cvTrue
andGate.Output.Link(FF)

FF.Input1.Link(andGate)
FF.Input2.Link(isCableDown)
FF.Output.Link(cableDown)
FF.Operate = cvTrue
End Sub

Sub init()

motion.IOLine = 5
motion.Direction = cvInput

isCableUp.IOLine = 6
isCableUp.Direction = cvInput

isCableDown.IOLine = 8
isCableDown.Direction = cvInput

cableDown.IOLine = 7
cableDown.Direction = cvOutput

End Sub


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:

http://docs.yahoo.com/info/terms/

No comments:

Post a Comment