Android Question recive and show multidata from bluetooth

poya10

Member
Hi, I want to take the information of the four temperature sensors as shown below and show them separately

1) Q23 , 2) W41 , 3) S-12 , 4) E21 ==> t1= 23 c , t2= 41 c , t3= -12 c , t4= 21 c

All this information is received together ( Q23W41S-12E21 ) and must be displayed separately
I know how to receive data via Bluetooth, I have trouble separating data.
 

poya10

Member
Thanks, can you tell me how you found this pattern?
Does my input (Q23W41S-12E21) work properly with this pattern?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Thanks, can you tell me how you found this pattern?
Does my input (Q23W41S-12E21) work properly with this pattern?
No. I now see that I misread your post and thought that you need to parse a different pattern. Your post is a bit confusing.
 
Upvote 0

poya10

Member
Sorry, the Arduino board actually sends information from 4 sensors (or any data) in a string, my goal is to parse this string.
For example, I want to get the value of the four variables as follows from arduino

Arduino Side:
float ST1,ST2,ST3,ST4;

void setup(){
    Serial.begin(9600);
    
    ST1=12;
    ST2=25;
    ST3=-10;
    ST4=19.23;
}

void loop(){
    
    Serial.print("Q");
    Serial.print(ST1);
    Serial.print("W");
    Serial.print(ST2);
    Serial.print("E");
    Serial.print(ST3);
    Serial.print("R");
    Serial.println(ST4);
    
    delay(200);
}

// Serial output: Q12W25E-10R19.23

Now, this serial output is received exactly on Android, the value of Q must be inserted in place of sensor one, the value of W in place of sensor two, the value of E in place of sensor three, and the value of R in place of sensor four. (I want the information of these four sensors to be seen in the Android application)
 
Upvote 0
Top