Android Question BLE + SeekBar1 (Solved)

f0raster0

Well-Known Member
Licensed User
Longtime User
Hello Guys,
I am looking for an option to write a value in my BLE modules from a SeekBar, but can't make it work.
My try:

in Main I have:
B4X:
Sub SeekBar1_ValueChanged (Value As String, UserChanged As Boolean)
    Label4.Text= Value
    perc=Value
End Sub

Sub ButtonLedPorcentaje_Click
    CallSub(Starter, "WritePercent")

End Sub

in Starter I have:
B4X:
Public Sub WritePercent
    manager.WriteData("6e400001-b5a3-f393-e0a9-e50e24dcca9e", "6e400002-b5a3-f393-e0a9-e50e24dcca9e", Main.perc.GetBytes("UTF8"))
    Log("Main.perc - %")

End Sub

I'm getting this error when I try to change the value of SeekBar1
Found: , 14:20:E2:99:1E:FA, RSSI = -67, (MyMap) {-1=[B@c9a07, 0=[B@4b5e734}
Disconnected
Found: AController, C5:2E:D3:EF:84:97, RSSI = -57, (MyMap) {1=[B@4f8c0d5, 9=[B@26930ea, 7=[B@2ad4fdb, 0=[B@81ea78}
Discovering services.
Connected
Main.perc - %
java.lang.Exception: Sub seekbar1_valuechanged signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:198)
at anywheresoftware.b4a.BA$1.run(BA.java:335)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Note: using the App of Nordic Semiconductor my modules works fine. I can send any value between 0-100 to control a digital potentiometer. Want to do the same using B4A.
Edit1: I'm using the example https://www.b4x.com/android/forum/threads/ble-2-bluetooth-low-energy.59937/


Thank you
 
Last edited:

JohnC

Expert
Licensed User
Longtime User
The "signature" is how an event sub name and it's parameter variable types are defined.

I think the variable type for the parameter "Value" in the "Sub SeekBar1_ValueChanged (Value As String, UserChanged As Boolean)" should be an Int instead of a string
 
Upvote 0
Top