Here my problem
I am trying to use ServoMotor
If I do
Now if I do
Not working ...
B4J 8.30
Java jdk-13.0.1
Raspberry 4B
I am trying to use ServoMotor
If I do
Every thing work like expected.And to turn the servo from left to right
- gpio mode 1 pwm
- gpio pwm-ms
- gpio pwmc 400
- gpio pwmr 1000
- gpio pwm 1 48
- gpio pwm 1 96
Now if I do
B4X:
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
B4J 8.30
Java jdk-13.0.1
Raspberry 4B