I have spent many evenings working on this problem but have failed to come up with a solution.
I have programmed the ESP32 BLE example and managed to get the reading on my phone (MIT app).
My next challenge was to add a second temperature probe and get a two readings. I thought this would be a simple modification to the code and app. How wrong could I be.
I have spent hours rummaging through Google pages and have made dozens of changes to the code and to the app.
I have tried to send the second by concatenating to the first reading and putting a character in between so that I can use the Split function in the App Inventor.
I can see the two readings in Serial Monitor but the App can only see one value and I get an error in the app.
Can anyone suggest what commands I should be using? I don’t fully understand the char array but it seems that strings are more resource hungry than chars.
i had the same problem i fixed it using this function sprintf(buffer,”%1s,%1s,%1s,%1s”,temp,pres,high,hum);
pCharacteristic->notify(); so i can sent more that one value in a UUID, (but of course you can create several UUIDS and use several BLE on MIT APP however i think that isn’t efficient is better this way) and now the last thing you have to do is add two timer and create to global functions (i call it data_in anda data_list) after that i just do same thing you saw on the moduel with one exception set data_it to stringValue and after that data_list slipt data_in at “,” (you’ll find that box in Text) and thats it and now you only have to do select intem in the lista de Data_list index 1 or 2 or 3 and set it on the expected value. and finally use the second timer to reset the data on that list
Thanks for the reply,
I saw your solution yesterday and tried it but I wasn’t sure where to put the line of code and what else needed changing in the ESP32.
I put the code (modified for my two inputs) after the dtostrf command, but when I ran the code it kept rebooting the CPU. The sprint command seems to crash the CPU.
Your method is now working for me. I was using the wrong variable names in the wrong part of the code.
Thank you Juan, you have put an end to hours of frustration.
Thank you for sharing the solution Juan! I’m glad it worked for you too Graham.
I still have a small problem. I’ve tried several things but can’t find the cause.
I am sending two values to the app, using Juan’s method and displaying them on separate lines on my phone, but the first value has an open bracket before the number and the second value has a close bracket after the number.
Temperature 1 (22.5
Temperature 2 23.7)
I added a label in the app, to display the buffer value, in order to see what the board is sending and it displays (22.5,23.7)
If I print the buffer to the IDE serial monitor it shows 22.5,23.7 i.e no brackets.
Any idea what causes the ()