Sub Process_Globals
Private Gpio As JavaObject
End Sub
Sub AppStart (Args() As String)
Log("Started")
initServo
StartMessageLoop
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub initServo
Gpio = Me
Gpio.InitializeStatic("com.pi4j.wiringpi.Gpio")
Private fd As Int = Gpio.RunMethod("wiringPiSetup", Null)
Log("wiringPiSetup " & fd) '0 = OK
Gpio.RunMethod("pinMode", Array As Object (1, 2)) 'PWM_OUTPUT = 2
Gpio.RunMethod("pwmSetMode", Array (0)) 'PWM_MODE_MS = 0
Gpio.RunMethod("pwmSetClock", Array (400))
Gpio.RunMethod("pwmSetRange", Array (1000))
Log("Tour1")
Gpio.RunMethod("pwmWrite", Array (1, 48))
Sleep(2000)
Log("Tour2")
Gpio.RunMethod("pwmWrite", Array (1, 96))
Sleep(2000)
ExitApplication
End Sub