How do I make a voice alert message using ardiuno uno software and mit app inventor?

I am making a project using ardiuno uno and it mit app inventor and bluetooth module. It detects the obstacles coming in front of it below 80 cm and it also shows the distance in 4 lines like 50cm, 30cm,60cm, 20cm. So what coding shld I use to get a alert voice message in mit app inventor if the obstacle is coming below 80cm.
Plz tell me ASAP
Tq

measuring_object_distance1.aia (2.4 KB)
this is the aia file of my app


and this is the image of code using ardiuno uno

What have you tried? Have you reviewed our tutorials and frequently asked questions? There are many sample blocks and apps that show you how to receive and send data.

You've done very little in AI2:

Your AI2 Clock is slower than your transmitting loop:
Capture

You should check for input twice as often as the transmitter transmits.

You include the text "cm" in your messages.
You should either leave that out or remove it from the messages in AI2 if you are going to do math comparisons.. AI2 math blocks are very fussy about their inputs.

Look in the other Designer folders for the Text To Speech component, for your speech output.

Here is general advice about using Delimiters in AI2 ...

Please see the Delimiter article in FAQ

Be sure to use println() at the end of each message to send from the sending device, to signal end of message. Do not rely on timing for this, which is unreliable.

In the AI2 Designer, set the Delimiter attribute of the BlueTooth Client component to 10 to recognize the End of Line character.
BlueToothClient1_Properties
Also, return data is not immediately available after sending a request,
you have to start a Clock Timer repeating and watch for its arrival in the Clock Timer event. The repeat rate of the Clock Timer should be faster than the transmission rate in the sending device, to not flood the AI2 buffers.

In your Clock Timer, you should check

  Is the BlueTooth Client still Connected?
  Is Bytes Available > 0?
     IF Bytes Available > 0 THEN
       set message var  to BT.ReceiveText(-1) 

This takes advantage of a special case in the ReceiveText block:

ReceiveText(numberOfBytes)
Receive text from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.

If you are sending multiple data values per message separated by | or comma, have your message split into a local or global variable for inspection before trying to select list items from it. Test if (length of list(split list result) >= expected list length) before doing any select list item operations, to avoid taking a long walk on a short pier. This bulletproofing is necessary in case your sending device sneaks in some commentary messages with the data values.

Thank u for ur suggestion

It's showing 4 values here so I need only 1 value for that what shld I do?

Show us the 4 values and what is between them.
Also show us the latest sketch and Downloaded Blocks Image and exported .aia file.

I mean from the aia file I have sent in label 1 i.e the value label I get to see 4 no. Like for example: 67,56,116,72
While I connect with bt

Look for the article "How to Work With Lists" in


Like this

From this I want only one to show