I use the modules nRF BLE to read data we have to send "nofity true" maybe that is your case you need to active it.When I use program BLE_Example, when I press button Read Data, I get this:
View attachment 77760
View attachment 77761
View attachment 77762
Can someone explain how to transfer and receive data from the Bluetooth module? I could not find more than one topic where it was explained. Sorry if I do not understand something ...
I can not receive data, do not send data to the bluetooth module with the help of B4x. I gave above that with the help of the application nRF Connect I can send and receive data (they are in "0000ffe1-0000-1000-8000-00805f9b34fb"),Question, you can not read data using B4x app? Or the problem now is sending data to the module?
If C.StartsWith(CharacteristicIdStartsWith) Then 'and this one is it
SaveCharacteristicId = C 'then save it (ServiceId already saved)
'if SetIndication doesn't work, then try SetNotify
Dim Result As Boolean = BleMan.SetIndication(SaveServiceId, SaveCharacteristicId, True)
Log("SetIndication " & Result)
'BleReadTimer.Interval = 10000 'and read it every 10 seconds
'BleReadTimer.Enabled = True
End If
*** Service (starter) Create ***
Let the games begin...
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Device = 78:59:88:95:CD:16 -33
Device = FF:FF:C0:20:9A:E5 iTAG -33
Device = 47:00:33:6D:1F:AE -25
Device = 60:03:08:B9:B3:AA -33
Device = 07:42:08:E3:ED:4A -46
Device = 3A:43:0C:CD:15:81 -46
Device = C8:69:CD:10:1E:C9 -33
Device = D3:CC:CB:F7:AC:09 34507 -27
Discovering services.
Connected
Service = 00001800-0000-1000-8000-00805f9b34fb
Service = 00001801-0000-1000-8000-00805f9b34fb
Service = cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Service = 0000180f-0000-1000-8000-00805f9b34fb
Service = 00001804-0000-1000-8000-00805f9b34fb
Service = 0000180a-0000-1000-8000-00805f9b34fb
Service = 000018ff-0000-1000-8000-00805f9b34fb
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E2
Setting descriptor. Success = true
writing descriptor: true
SetNotify true
Characteristic 8cd67da0-da9b-11e3-9087-0002a5d5c51b = "." 01
Characteristic 00002a1c-0000-1000-8000-00805f9b34fb = ".A..." 00 41 BD 00 00
Characteristic 00002a21-0000-1000-8000-00805f9b34fb = ".." 1E 00
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E1
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E2
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E2
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E1
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E2
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E7
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E8
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E6
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF EE
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF EA
DataAvailable cc4a6a80-51e0-11e3-b451-0002a5d5c51b
Characteristic 835ab4c0-51e4-11e3-a5bd-0002a5d5c51b = ".." FF E8
'*** AND LAST, BUT BY NO MEANS LEAST, A FUNCTION TO STOP ME GOING CROSS-EYED ***
Sub ByteArrayToReadableString(BA() As Byte) As String
Dim ReadableAscii As String = ByteArrayToAsciiString(BA)
Dim ReadableHex As String = ByteArrayToSpaceSeparatedHexString(BA)
Return Chr(34) & ReadableAscii & Chr(34) & " " & ReadableHex
End Sub
Sub ByteArrayToAsciiString(BA() As Byte) As String
Dim AsciiString As String = ""
Dim Ch As byte
For I = 0 To BA.Length - 1
Ch = BA(I)
If Ch >= 32 And Ch <= 126 Then 'within byte range so no sign problem
AsciiString = AsciiString & Chr(Ch)
Else
AsciiString = AsciiString & "."
End If
Next
Return AsciiString
End Sub
Sub ByteArrayToSpaceSeparatedHexString(BA() As Byte) As String
the nRF connect is a super cool great App dedicated for Bluetooth, I use it with my modules too.I can not receive data, ......
but when I watch "0000ffe1-0000-1000-8000-00805f9b34fb" (at B4x) there is nothing there ...
I did it and everything works fine !!! The data comes exactly the ones I sent! If the data is> 20 bytes, it breaks it into two messages.1/ Change this bit of the DataAvailable routine to:
Code:
If C.StartsWith(CharacteristicIdStartsWith) Then 'and this one is it
SaveCharacteristicId = C 'then save it (ServiceId already saved)
'if SetIndication doesn't work, then try SetNotify
Dim Result As Boolean = BleMan.SetIndication(SaveServiceId, SaveCharacteristicId, True)
Log("SetIndication " & Result)
'BleReadTimer.Interval = 10000 'and read it every 10 seconds
'BleReadTimer.Enabled = True
End If
ie add 3 x SetIndication lines and comment out 2 x timer lines
I did it and everything works fine !!! The data comes exactly the ones I sent! If the data is > 20 bytes, it breaks it into two messages.
Another such question appeared: there is such a parameter RSSI (as I understood it so I can indirectly determine the distance to the device). Can I somehow request this option except "Sub BleMan_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)"?
red30 said:I also noticed on Friday that if I make a request for BleMan.WriteData, and I do not ask again, there are times that it does not reach at all ... Why can this happen?
At a distance of ~ 25-30 m from the module RSSI bluetooth is -(90-95) and the connection breaks down. Although the documentation says that the maximum distance is 80-100m. Why can this happen?
I will point out my mistake there
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?