Receiving and displaying data from Arduino

Jaybird2203

New Member
Licensed User
Longtime User
I have a slight problem getting my app to display a numeric value that is being sent by bluetooth from my arduino using the serial.print() command.

I can send data to another android that is running the exact same app and display that info properly, just having an issue with external information and I figure I'm missing something simple. Once I send the information from the Arduino, it causes the app to stop responding and crashes. Any help would be greatly appreciated.

On the Android I have
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("all_buttons_on")
   If AStream.IsInitialized = False Then
      AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "AStream")
   End If
   
End Sub
and
B4X:
Sub AStream_NewData (Buffer() As Byte)
   Dim received As String
   received = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
   TemperatureLabel.text = received
End Sub

On the Arduino I have
B4X:
float tempC;

Serial.println(tempC, 1);

As you can guess I'm attempting to have a temperature sensor send data to be displayed on the app.
 
Top