There’s magic going on here!

If I didn’t include this video, you wouldn’t believe me! I have a simple analog read of a potentiometer with an HC-05 connected to an arduino. I built an app on app inventor and loaded it into my phone. As you can see on the video, the graphing of the data works as it should when I change the potentiometer. When I disconnect the app and then change the pot while the app is off and the HC-05 is not connected, apparently, the data is being recorded somewhere because when I reconnect, that data is now shown first on the graph as I had changed it while everything was off, and then it becomes live and shows data as I change the pot. How can this possibly be? The last thing I added to the app was the ability to store the last value such that when the app is restarted, the graph will start from the last data point instead of 0. OK, maybe I don’t understand the storage code, but to record while all is off………..? What’s going on here?

Here’s the video:
Here’s my code:

You should also include your code for the HM-05. If I had to guess, some data is being buffered there and when you reconnect the buffered data are transferred to the BluetoothClient's buffer. The component then reads and graphs whatever is available in the buffer.

Here it is:

int in = A0;

void setup() {


void loop() {
  //Map the value from 10 bits to 8 bits:
  byte val = map(analogRead(in),0,679.0,0,255);    //Byte = 8 bits = 2 to the 8 = 255 
   Serial.println(val);                            //map 3.3volts to 255 (1023*3.3/5)
  delay(600);                                        //Small delay between each data send  

Can you tell me where to look for details about that? I would want to leave the arduino powered all the time, so can I have it stop bufferring once the HC-05 is disconnected? Does the storage component in app inventor read in the buffered data? Can I make it read just the last bit of data? How might I do it so that only one bit of data is retrieved when starting the app?

Thanks for your help.

I used a hidden label to dump the data in prior to starting to read new data. Works good!