How can I get my Arduino to send my App a text that can then be used to tell the Texttospeech block to speak a Certain message

Hello, new here, and excuse the bad english! I have a project that consists of a Smart elevator, and i have each floor with it's button, and i also have a speech recognition that sends the Arduino certain numbers so the Arduino can detect it and energize the motor, but, i want that when the motor gets to the sensor it sends a message that can then be received by the app for it to send a text to the Text to speech converter so it can send a message such as "Floor 1 reached" and such, any ideas or tips?

You could send a simple byte (or two) from the Arduino that corresponds to a floor, and then call the Text-to-speech function for the floor value that is sent. Perhaps you could map these values in the form of a dictionary.

If it's too much to ask is there any example you could give? Quite new to MIT too

Dear @Alicia_Marie_Gonzale,
please take a look at the following blocks:

I simulate the BT communication by means of buttons.
By setting the Country and the Language in the Screen1 Initialize block you can set yours.
The code is far from being optimized, but in this way it's simpler to understand how it works.
In your app, instead of buttons, your BT receiving procedure shall fill the global variable "floor" with the text received by Arduino, then will call the procedure TTS_Speak directly.
To this purpose, it is easier whether your Arduino sends directly a string, like:
BT_Serial.println("First"); or
BT_Serial.println("Second"); and so on.
Take care of the use of a println() and not only .print(). The reason why is fully described in many tutorials and posts by @ABG, @Juan_Antonio and @ChrisWard.

I've tested it on a Xiaomi5 phone (Android 8). I hope that with newer Android versions, it will work, as well. Here below also the .aia file
Cheers.
TTS_Sample.aia (2.7 KB)

1 Like

Hello! I was trying to do this but i couldn't get my head around it, excuse if it seems that i'm a troubled person to understand this, but i do not understand the part of Bluetooth by means of buttons part, i wish that, when the sensor reaches a floor it sends the app a text such as an "a" the app detects it, and initializes it's text to speech, maybe i did not understand it correctly, my apologies

Dear @Alicia_Marie_Gonzale,
never mind ! I believe that if someone cannot understand what I say is due to the fact that I've been not clear enough !!!
I try to say what I did in a different way.
It is clear that you want that when the sensor detects that a floor has been reached, the Arduino board sends via BT a character to the app, which, on his side, has to say: "Floor 'x' reached".
For example: supposing that the sensor detects that the first floor has been reached, the Arduino board will send on BT the character "1", the app receives this character and says "First floor".
The same for all the floors.

My .aia does that: when you hit a button, let's suppose Button 1, the app speaks "First floor".
The same for all the other buttons. This shows you how to initiualize the TextToSpeech and how to use it.

What you have to do is to replace what I do with buttons with your BT receiving procedure, because I suppose you already have one; if not, please read th examples that @Juan_Antonio has made available on his web site (kio4.com). Many of his samples are in Spanish.

I'm sorry but I will be out for a few days, so I cannot prepare a complete code for you, anyway I'm pretty sure that by using the "ready made" chunks of code on KIO4, you will succeed in your aim.
Buona suerte !

PS if your mother tongue is Spanish,

1 Like