This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Friday, January 11, 2008

[oopic] events again

I know I just ask the question but I still can't get it to work. I
hope that someone can help.
Oopic C.1.1+ compiler 6.1.1
Hardware wise I have a switch, one side hooked up to 5 volts the
other side hooked to ground with a 1K resistor. When the line is not
connected to 5 volts it is connected to ground. Just to make sure it
was not the switch I took it out and just used a jumper on my proto
board. I tested it before I hooked it to the oopic
My code is below
I have an if statement in a do loop. If I comment out my event code
and uncomment the if statements in a do loop the program works just s
it should. When I disconnect the 5 volt line the yellow light blinks
with 5 second delay.
With no hardware changes, if I comment out the do statement and the
if statement, so I just have the event as it is now it does not work.
What am I doing wrong?

Dim ev1 As New oEvent
Dim led7 As New oLED
Dim led6 As New oLED
Dim led5 As New oLED
Dim sw1 As New oSwitch
Dim wi1 As New oWire

Sub main()
led7.IOLine = 7 'red
led6.IOLine = 6 'yellow
led5.IOLine = 5 'green
sw1.IOLine = 13 'read the switch on line 13
ooPIC.Delay =500
led7.TurnOn 'some indication it is on
wi1.Input.Link(sw1.Position)'read the switch normally 1
wi1.InvertOut = cvTrue 'yes invert the output
wi1.Output.Link(ev1.Operate) 'inverted output to event norm 0
wi1.Operate = cvTrue 'turn the wire on
'Do
'If sw1.IsOff 'if switch is at zero volts logic 0
' led5.TurnOnBright
' led6.TurnOff
' ev1_Code
'Else 'if switch is at 5 volts logic 1
' led6.TurnOn
' led5.TurnOff
'EndIf
'Loop
End Sub

Sub ev1_Code()
Do 5 Times
led6.TurnOn
ooPIC.Delay = 1000
led6.TurnOff
ooPIC.Delay = 1000
Loop
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: