Data from BLE are read only once

If i am receiving Data from my arduino to my App inventor, it means that my code is correct. If my serial monitor is updated every second but my app inventor is still fixed on the first value registered it means i need to fix my app inventor blocks not my arduino code.

You've changed the way your data is combined. Before there was a comma, now you have a newline. As ABG mentioned change the "listFromCsvRov" block to "listFromCsvTable".

Okey i will change and show you results, i have one question i don(t change the arduino code? nor another block on app inventor, like adding Clock or something?

Yes, the while loop in the loop() procedure is a bit weird, but it should work. It's kind of hard to debug a hardware-dependent program without having that hardware.

Regarding the lack of second and third transmissions, here are some questions ...

  • I see a Clock Timer that issues read string commands. How do I know that the Clock is enabled?
  • How do I know if you are receiving the same values over BLE repeatedly, with no way of knowing if they came over in new messages?
  • What code should I look for in a BLE sketch to respond to a Register For Strings request?

Use these blocks:

  1. With a RegisterForString block in the Connected event.

  2. With a ReadStrings block in the timer running with an interval of 1000ms.

This will show us the raw data. And then we can adjust the appropriate data extraction method.

1 Like


Not working,

What is RegisterForInteger doing in your blocks? Delete this block.

Good point, Sorry I corrected it, still not working

Show what the blocks look like now.

Use either method 1 or method 2. Not both at once. Remove RegisterForString and then check.

I removed the Vol(L): and D: from my code, left only the Calc and Q values and keps the same blocks as i showed you now ( My previous picture) here is what i am getting. The values are live but Repeated sooooo sooo maany times.



Maybe they are read twice... Try to do what I wrote above. Show in arduino code what you removed.

here is what i kept in my arduino ( I changed one line)
while (central.connected()) {
NbTopsFan = 0;
delay(1000);
Q = (NbTopsFan / 9.5);
String Q_str = String(Q, 2);// Round to two decimal places

  Calc = (Q / 60) + Calc;
  String Calc_str = String(Calc, 2); // Round to two decimal places
  String To_App = Calc_str + '\n' +  Q_str + '\n';
  Serial.println(To_App);
  dataCharacteristic.writeValue(To_App.c_str(), To_App.length());
  delay(200);

I removed Vol and D:
String To_App = "Vol(L):" + Calc_str + '\n' + "D:" + Q_str + '\n';

I understand, you are only sending data without tags.

Okey I will do this.

Your suggestion, is that I remove all this bloc?
Capture d’écran 2023-07-04 165414

"RegisterForStrings" block only