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

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.

Thank you but I do not get what I need to do.

You are using 3 different globals, 2 of them which I don't have while I only use 2 globals.

I have the DataList global but I'm missing the "DataCsv and DataLength"

Just create variables the "DataCsv and DataLength" ... you can see how it was done in the simulation Blocks and aia. You will need to do something similar. Does that help?

To make it work you will have to have a correct DataList

1 Like

Yup. Thank you.

Yup, still not working and the same error :expressionless:

And also one more error now together with that one because why not