I'm using the BLE example. I added a button to send a "G" cr to a connected RN4871 microchip BLE module connected to a micro thru a uart. When the micro receives a "G" cr, it turns on an led. I know the RN4871/micro works because I've sent "G" cr from the Microchip App and, with the BLE Ext library example, but, I can't seem to get the BLE2 example to work.
Here is the code:
The WriteData is called from main when a send button is clicked, which I press after Scan and Connect button and a connection has been made.
Here is the code:
B4X:
Sub Process_Globals
Public manager As BleManager2
Public currentStateText As String = "UNKNOWN"
Public currentState As Int
Public connected As Boolean = False
Public ConnectedName As String
Private ConnectedServices As List
Public rp As RuntimePermissions
Public DATA_SERVICE As String = "49535343-fe7d-4ae5-8fa9-9fafd205e455" 'data service for RN-BLE RN4871, write to pc
Public DATA_UART_RX As String = "49535343-8841-43f4-a8d4-ecbe34729bb3" 'write writenoresponse
Public DATA_UART_TX As String = "49535343-1e4d-4bd9-ba61-23c647249616" 'write writenoresponse Notify Indicate, THIS AS 'SET.NOTIFY'
End Sub
Public Sub WriteData()
Dim d() As Byte
d(0)=0x47 'G
d(1)=0x0d 'cr
manager.WriteData(DATA_SERVICE,DATA_UART_TX,d)
End Sub
Sub Service_Create
manager.Initialize("manager")
End Sub
The WriteData is called from main when a send button is clicked, which I press after Scan and Connect button and a connection has been made.