'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim yoyo As IOIOBT
Dim led As PwmOutput
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim ToggleButton1 As ToggleButton
Dim SeekBar1 As SeekBar
Dim SeekBar2 As SeekBar
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
SeekBar1.Max=100000
SeekBar2.Max=100
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then yoyo.Disconnect
End Sub
Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
led.PulseWidth=Value 'value is in microseconds
Activity.Title="pulse width is "&Value&" microseconds"
End Sub
Sub SeekBar2_ValueChanged (Value As Int, UserChanged As Boolean)
led.DutyCycle=Value/100 'value is in %
Activity.Title="duty cycle is "&Value&"% of 10Hz"
End Sub
Sub ToggleButton1_CheckedChange(Checked As Boolean)
If Checked Then
yoyo.Initialize(False)
yoyo.WaitForConnect
led = yoyo.OpenPwmOutput( 0,led.OP_NORMAL,10) ' Enable LED_PIN for output
Else
yoyo.Disconnect
End If
End Sub