When i get data from micorcontroller analog value i can't compare it to integer

hello everybody just asking for your help please

my project is about reading analog value from the microcontroller then convert the readings to string
and send it to an app in the phone using mit app inventor for example :slight_smile:

mcu send text value: "1023" i can display it in the phone app with no problem and the data is correct
but i want to compare this data for example if the data is greater than 1000 i want to display a warning message in mit app inventor.

i think maybe the mistake is in comparison of the values received which is text and the number in mit app!

is there any solution guys?

What about taking a look at math blocks?

If value > 1000
Warning massage 

hello Arman

i tried it but with no sucess

hello,

it will not work i need to convert receiced text from mcu to integer then the comparison will work but i don't how to do that

Show us what exactly you get from mcu. For appinventor it doesn't matter whether the number is a number or a string. It is important that the string contains only digits without additional characters, e.g. spaces or other characters.

1 Like

image


Note that the SplitWith method returns a list, which is why it is necessary to use the select list item block.

(I'm using KevinKun's regex extension).

Hello friends, i tried also your solutions but also the same problem you can see i uploaded all the picture about the project please let me know where is the mistake?




If you are going to send text, use a message delimiter:

Here is a simple BlueTooth text receiver sample, for single value per line:
blocks
initialize global message to


Read the ReceiveText tool tip for an explanation of the -1.

Before you try to math against your incoming message, first use an is a number check to filter out that AT+... nagging.

1 Like

hello guys ,

thank you very much for you help i follow all your intsructions and it worked good.

many thanks to all of you for the help and support ''ABG, NishyanthKumar, Partyk_f,Arman"'

best regards

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.