Android Question BLE2 Library issue. ("Unknown Type: ble2")

JacoMuller

New Member
Licensed User
Longtime User
I am doing a project to monitor the signals for the lights on a tow wiring harness. I want to read 5 GPIO signals with my ESP32. The names of the signals are Left indicator, Right indicator, Brake, Reverse, Tail/Park. I want to do the sketch in Arduino IDE. I then want to connect to my Samsung Phone via Bluetooth. I want an app on my Samsung phone, written in B4A to show the status of the signals. The ESP32 sketch is done and I have tested the Bluetooth message with nRF Connect - all good. The issue is with B4A and more specific the BLE2 Library. I cannot get B4A to compile. There is an error "Unknown Type: ble2". I have selected BLE2 in Library manager. Installed version 1.41, online version 1.39. I have used ChatGPT to assist with the code for B4A as I am familiar with Arduino IDE and ESP32 for ESP32 code. The first round of code from ChatGPT was comprehensive and included everything that I have asked for. Only issue is, the BLE2 library error keeps popping up. ChatGPT then simplified the code for fault finding but the error is still there. I am at a point where the code is only:
B4X:
Sub Process_Globals
End Sub

Sub Globals
    Private lblStatus As Label
    Private btnConnect As Button
    Private ble As BLE2
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("MainPage")
    lblStatus.Text = "Disconnected"
    btnConnect.Text = "CONNECT"
End Sub

Sub btnConnect_Click
    lblStatus.Text = "Button pressed"
End Sub
The error is in the line 7, "Private ble As BLE2".

What am I missing?
 

JacoMuller

New Member
Licensed User
Longtime User
Have you used the ble2 library before? there is no type ble2, perhaps it is BleManager2, here is the example.
Thanks for the feedback:). No, I am completely new to B4A. I have done a number of VB and VBA projects and I am working with Arduino IDE for my ESP32 projects. Normally, I don't have a need to do an App for Android but in this case, the "user interface" for my ESP32 must be on an Android phone, connected via Bluetooth or BLE. The code I have so far is ChatGPT generated. The reason for going for B4A is that I am familiar with VB and I think the learning curve will be shorter. I will have a look at the example.
 
Upvote 0

Mariano Ismael Castro

Active Member
Licensed User
Longtime User
I suggest you start with the example project that Erel posted in the thread you were already given the reference to. It works very well.

 
Upvote 0
Top