Platforms to show: All Mac Windows Linux Cross-Platform
/USB/IOWarrior/IO Warrior Mac OS X LEDs
Required plugins for this example: MBS USB Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /USB/IOWarrior/IO Warrior Mac OS X LEDs
This example is the version from Sun, 17th Mar 2012.
Project "IO Warrior Mac OS X LEDs.xojo_binary_project"
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control init Inherits Label
ControlInstance init Inherits Label
End Control
Control present Inherits Label
ControlInstance present Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control write Inherits Label
ControlInstance write Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
dim n as integer
dim v as integer
dim d as date
n=io.ReadInterface0(v)
if n=0 then
if v<>last then
d=new date
read.text=str(v)+" ("+d.LongTime+")"
last=v
end if
else
read.text="Error "+str(n)
end if
if CheckBox1.Value then
if counter>=16 then
counter=0
end if
if counter>=8 then
n=255-pow(2,15-counter)
else
n=255-pow(2,counter)
end if
write.text= str(io.WriteInterface0(n))
counters.text=str(counter)+" "+str(n)
counter=counter+1
else
write.text= str(io.WriteInterface0(counter))
counters.text=str(counter)
counter=counter+1
if counter=256 then
counter=0
end if
end if
End EventHandler
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control counters Inherits Label
ControlInstance counters Inherits Label
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action()
if me.Value then
Timer1.Period=10
else
Timer1.Period=100
end if
End EventHandler
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control read Inherits Label
ControlInstance read Inherits Label
End Control
EventHandler Sub Open()
if TargetMachO then
else
MsgBox "Please use only with MachO targets on Mac OS X!"
quit
end if
io=new IOWarriorCarbonMBS
init.text= str(io.Init)+" init"
present.text= str(io.IsPresent)+" present"
End EventHandler
Property Protected counter As integer
Property Protected io As IOWarriorCarbonMBS
Property Protected last As integer
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
The items on this page are in the following plugins: MBS USB Plugin.