Advertisement
Guest User

Untitled

a guest
May 2nd, 2012
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' The LED is defined as a single I/O line
  2. Dim Red As New oDio1
  3.  
  4. ' Here we create a virtual wire. Wires are
  5. ' used to link output or flag values to
  6. ' input values.
  7. Dim W As New oWire
  8.  
  9. ' All OOPic programs need to define a "main" sub-routine.
  10. ' This is what will be run when the OOPic is turned on.
  11. Sub Main()
  12.   ' Here we specify the pin number for the I/O line.
  13.  ' The onboard red LED is on pin 7.
  14.   Red.IOLine = 7
  15.  
  16.   ' The LED can also be used for a button, so we need
  17.  ' to specify whether we wish to read from or write to
  18.   ' the pin.
  19.  ' (cvOutput is a constant value)
  20.   Red.Direction = cvOutput
  21.  
  22.  
  23.   ' Now we can set up the wire link!
  24.  ' For the wire's input, we wish to use the built-in
  25.  ' 1Hz timer.
  26.   W.Input.Link(OOPic.Hz1)
  27.  
  28.   ' Now we send the output of the wire to the LED.
  29.  ' Note that we actually send it to the "Value"
  30.   ' property of the LED, as this is what determines
  31.  ' whether the LED is lit.
  32.   W.Output.Link(Red.Value)
  33.  
  34.   ' All that's left to do is to tell the wire to
  35.   ' operate, and the OOPic will do the rest!
  36.  ' (cvTrue is a constant value)
  37.   W.Operate = cvTrue
  38.  
  39. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement