Hi everyone! I am developing an application in which I receive two voltage data from the ESP32 via Bluetooth, sent every 100 ms, and I need to plot this on a graph that updates in real time. Furthermore, the ESP32 has the function of activating a buzzer when the voltage passes a specific value, which is why the "config" screen has sensitivity adjustment. I also have to have multiple graphs and be able to change them as desired, in the "config" screen. I'm having some problems and would like someone to help me understand what I'm doing wrong.
I'm having trouble changing the graphics. For example: When starting the app, connecting to Bluetooth and clicking on the "play" icon, the values are received and the graph oscillates according to the values, however, when accessing the "config" field and changing to the linear graph, the graph changes on the screen, however it does not show the values, as if it were frozen.
At times, when I am using the first "chart" option, simulating a bar chart, an error message appears on the screen indicating that the values received are not allowed. As:
- [25t1],[25].
In this case, my logic for receiving the string sent by the ESP32 is not working completely.
At times, my data reception is slow. I'm changing the voltages that my ESP32 sends through a potentiometer and I see that sometimes my application is very slow in updating the information, both in the graph and in the label
Below, I will leave my ".aia" file for viewing. If you have any questions about my explanation of my application, please ask me. I hope you can help me with these questions. MultipeScreams_Screen_pontoDeControle1.aia (1.1 MB)
Also post your sketch code, for compatibility testing.
I suspect your problem comes from trying to mix two different approaches to handling incoming BlueTooth data:
Grabbing the input directly through ReceiveText and parsing it in blocks
Telling the AI2 Chart component to read the BlueTooth data stream for its chart.
For your case, where you want more flexibility, I recommend just collecting the incoming data in lists and tables (if you need to match t1 and t2) and doing the graphing from the lists and tables.
The idea would be instead of using the "chart" tool the way I'm using it, would it be to use tables placing values received from a list? That way, would I use the same list to provide data for the chart I define?
Regarding the other questions I asked, related to the slowness of receiving information, is there anything I could change, such as my clock time or another setting to improve this?
To insure timely reception of BlueTooth data, use only a single Clock Timer for your ReceiveTexts, one ReceiveText per cycle, and cycle twice as fast as the transmitter to avoid backlogs. You are using 100 milliseconds in your transmission delay, so I recommend 50 milliseconds for your Ai2 Clock Timer driving the reception of data.
Could you provide me with an example to apply a list as input values for my chart? So, I will use this list for both my bar chart and my linear chart.
From what you mentioned, the way I'm doing it could cause delays? Using a timer for each graph.
What would I need to change to be able to view my data received via Bluetooth? In the example, random values are being used, I simply tried to change it to use the value received from Bluetooth, which is being sent by my ESP32 every 100ms. I will leave my .aia file below. charts_drunkard_walk.aia (4.4 KB)
I added the required BlueTooth Delimiter value of 10, to be able to grab whole messages one at a time.
I also switched the plotting away from the entire message to just the frequency part of the incoming messages with f1: in front, for just those matching messages.