Android Question Arduino 101 receive data

tigleth

Member
Licensed User
Longtime User
Hello

Using the Arduino 101 ble2 example i have been sending data reliably; also i receive the millis in the custom list view on android. How do i get the data "millis" into a variable i can use. Stepping thru i see the millis field get filled; i cannot yet get the value in a variable.

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
Why you are posting the same comment AGAIN (pushing the thread again)?

PD: It would help others to help you if you would post a small Example-Project which shows the problem.

Without seeing your code we cannot guess what is wrong or what you do not understand.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The code that creates the CLV items is here:
B4X:
Sub DataAvailable (Service As String, Characteristics As Map)
   pbReadData.Visible = False
   clv.Add(CreateServiceItem(Service), 30dip, "")
   For Each id As String In Characteristics.Keys
     clv.Add(CreateCharacteristicItem(id, Characteristics.Get(id)), 40dip, "")
   Next
End Sub
Can you post a screenshot of the screen with the data shown?
 
Upvote 0

tigleth

Member
Licensed User
Longtime User
Hello

Sorry for not posting properly; do my best; not familiar with posting and I will make mistakes.

The code is the example; the b4a side; everything seems to be working. I seem unable to express my issue clearly.
In the picture on the bottom line of the clv you see a number; the millis sent from the Arduino. I would like to use that number; not just see it. When I step thru I see it come up on the bottom line on the picture (clv); have no idea where that millis number exists. How can I put that number (the millis ) in a text box by itself? Or place it in some type of variable. Or use it.

Thank you
 

Attachments

  • Capture+_2017-04-13-04-43-44.png
    Capture+_2017-04-13-04-43-44.png
    124.3 KB · Views: 248
Upvote 0

tigleth

Member
Licensed User
Longtime User
Hello

placed the code in Main dataAvailable;in Starter used ReadData2 to get one line on the clv and from the b4r side send constant "111111" see picture; get "111111" every time in clv and various hex numbers as I press repeatedly readdata button in the lable3 all preceded with B@; how can I get the "111111" in lable3 ?


Thank you for your help







B4X:
Sub DataAvailable (Service As String, Characteristics As Map)
    pbReadData.Visible = False
    clv.Add(CreateServiceItem(Service), 30dip, "")
    For Each id As String In Characteristics.Keys
       
       
        clv.Add(CreateCharacteristicItem(id, Characteristics.Get(id)), 40dip, "")
   
   
        If Service = "00000001-0000-1000-8000-00805f9b34fb" Then
            
            Dim millis As String = Characteristics.Get("00001001-0000-1000-8000-00805f9b34fb")
            Label3.Text=millis
        End If
   
       
   
    Next
End Sub

cap.png
 
Upvote 0

tigleth

Member
Licensed User
Longtime User
Hello

Thank you; label3 shows "111111". I had tried hextostring thinking it was hex. I remember a tutorial on Bluetooth that discussed services and their characteristics; just cannot find it on your site again; there is so much great stuff.
 
Upvote 0
Top