Get max value from tinyDB?

Hello everyone, I am currently working on a project for class and could really use some assistance. My problem is as follows: arduino nano get value from sensor, then via bluetooth transmit to app, on app I


need to make a list of values ​​received from arduino then compare them to find out the value maximum or minimum value.

It looks reasonable to me (not having seen the arduino code).
What happens when you test?

1 Like

It will be easier if you save your datos in TinyDB as a List, not a String.

Thank you for reply
about the arduino code i get the data from the sensor, into a string and then send it all to the app. O
n the app i split the string into 1 variable. what i want is to create a list from the values ​​of that variable over a period of time and pick the largest value in that list.
Code here:
c

That is also my orientation. I'm having a problem creating a list.

what problem?

1 Like

The values ​​are saved in the list as items and I don't know how to compare the values ​​of the items in the list. Can you help me?
this block error:
image

I don't see any problem with this block.
what error do you get?

this error:
image

Display the contents of your list in a label to see what's wrong with that list. You probably have empty values ​​in the list, without numbers...

Check your Arduino code to see if it's sneaking in extra messages that don't have numbers.

There is an if/then value block you can use to return true or false values for noncomparable list items and there is a IS A Number block that will identify garbage before you apply math in your max/min tests

image
If your global A like this, you will get a list ["","123"], empty string can not be comparing with 123

A garbage filtering comparator...

AND(
Is a number(num1),
Is a number (num2),
num1 < num2)

1 Like

You need to check if it's empty or not BEFORE you decidet to add it to the String/List.

2 Likes


this problem is done. but the block only compares 2 values at the moment when i press the button, I want to compare all the values ​​in the list. how?

as mentioned, you need to make sure the item is a number before add to the list.
then you will not need the 'is number' block in the comparator.

2 Likes

how to compare all the values ​​in the list. this block only compares 2 values when i press button :slightly_frowning_face:

remove the 'is number 'block

1 Like

It looks like you send three variables but you want the maximum value of the entire set of variables.

Send the text with "," instead of "|" for easier coding.

borrar_listaord.aia (3.6 KB)

1 Like

Code based on ABG-s Maximum ermitteln - (Get the Max Number from a List) - #9 by SteveJG

might help. See his draggable blocks in post 10 to the above link.

1 Like