Hot to enter SeekBar value in AsyncStream

rfsingh81

Member
Licensed User
Longtime User
Can someone please help me solve this problem, I have a seekbar defined as Fan.

I want to send the value of the seekbar using asyncstreams. I am having errors and a big headache after trying many combinations which don't work. It may be very simple for most of you here but I still need help doing this.

B4X:
Sub Fan_ValueChanged (Value As Int,UserChanged As Boolean)
   If (UserChanged=True) Then
      Log ("Value:" & Value & UserChanged) 'This triggers fine when below is commented
      AStream.Write(Value.GetBytes("UTF8")) ' compile error with this line
   End If
End Sub
 

rfsingh81

Member
Licensed User
Longtime User
Thanks. This worked. The other side is a MCU so I can always make adjustments at that side. I would also like to ask, if I get a $30 from the other side (meaning 0) to $38 (meaning 8), what code I should use to assign the 0 - 8 to the seekbar?

Currently, in the new data routine, this is what I have:
B4X:
Sub AStream_NewData (Buffer() As Byte)
   Dim aaya As String
   If (Buffer.Length)>=1 Then
         aaya = BytesToString (Buffer, 0, Buffer.Length, "UTF8")........

I then use aaya.CharAt(0)....aaya.CharAt(4) etc etc type statements after this to adjust my app. I now want to adjust my seekbar based on one of the value, lets say at aaya.CharAt(5)
 
Upvote 0
Top