MIT App Inventor 2 & Highcharts data.csv configuration with RSSI and Distance Variables

It won't work

@ABG

Edit: I corrected the typo "/n" to "\n" and it returns the same error my dear.

Here is a basic CSV data collection sample app for you to study,
driven by a text box and an Enter button.

Capture csv_builder.aia (2.9 KB)

1 Like

I tried but t's not working, same error gets returned.

It is impossible to provide advice if you do not expose your entire Block code MelodyApril. I cannot see some of the critical Blocks where you post your RSSI,Distance data in a Label.

You should not have to create a data.csv file and store it using the File component to use ChartMaker.

Your image shows you 'capture' your data pairs (RSSI,Distance) in a Label.

0,2
0,2
-3,2

Are you? If you are sending the data to a Label as I believe you are, I probably have a graphing solution for you that might work .

The example I have in mind requires the data to be in the form Distance,RSSI to get the chart axes populated the example solution . Can you provide the csv data in the Label RSSI,Distance you currently provide?

1 Like

Here they are:

Elements:

Blocks:

Thank you.

A guess. Get rid of all the File control Blocks and add your data points to a List of your data pairs

where you write to a List instead of saving the /data.csv file.

I can not test your code so I made a 'simulation'

ExampleA

that creates the chart from dataList. I think you can create the dataList from where your earlier device image shows you 'capture' your data pairs (RSSI,Distance) in a Label.

0,2
0,2
-3,2

Bluetooth4Simulation.aia (184.8 KB)

Experiment and see if you can figure the simulation out and apply it to your Project. Good luck.

1 Like

Doesn't want to work, now it messed up the data received from the esp32 as well I don't receive any data.

Update: Got it to fetch the data from the Esp32 again but the graph still doesn't work

Perhaps perhaps

or
Try moving those two 'green' blocks.

You do not want to use the File component blocks at all if you create a DataList.

Did you get the example 'simulation' to run with dummy data?

Also, please DoIt with the DataList block (anywhere on one of them, right click and select DoIT )

1 Like

I tried doing what you say, same error comes, also doit does nothing.

there is only one item in your datalist...

also your add items to list block is wrong...
the list is called DataList
and the item you want to add is TextDataReceived...

Taifun

you might want to provide a screenshot of the latest relevant blocks including Do it result
Taifun

Screenshots provided bellow my dear

These are my latest blocks as they are right now and as I've said it seems like Doit does nothing so I don't know what else to try since it doesn't show anything after I click it.

Let's try again please

If DoIt is not responding, it means you do not have a connection active with Companion most likely or DataList is empty

This a DoIt using the simulation example

Here are the results:

it seems to be you have overseen my 2 latest answers here in this thread...
Taifun

I tried that my dear and it's not working:

@Taifun

well, you are adding all text data received to a large big string, which does not make sense...
at least if you want to work with lists...


instead you should convert each text data you are receiving into a list using the list from csv row block and then add that sublist as one item into the main list (called DataList)
you might want to set the main list to an empty list before continuing to test

Taifun

1 Like

Now the list only gets the first pair then doesn't get updated anymore and it gives the same error.

Regarding your Initiate_ChartMaker_Clock blocks ... once you fix the issue Taifun pointed to, make the event handler look like the Clock.Timer in the simulation or it the Clock will not work properly.

The two Block sets highlighted with a green arrow are necessary to prevent the chart from using bad data and to avoid flickering. They ensure changes only happen when the length to the data changes. Again, be aware the 'simulation' assumes your app is posting your data to a Label. I used Label5. which sets dataCSV to the contents of the label; then immediately sets dataList as indicated. This has to happen in the simulation and I assume it is necessary in your app. If I had an esp32 I certainly would have done this differently, so I created a simulation on the assumption you created a list of pairs.