How can i make the receiving data (word )from Bluetooth module display in the text box and also translate it in speech without clicking text to speech button

I m using mit app
Yes i did check with bluetooth terminal
Aa i using a machine learning program to predict the hand gesture and send that gesture value back to arduino and arduino will convert that value according to its program but the value the app is receiving is 0 1 2 3 which was given name of gesture during prediction.
The above code is not functioning.

I even change the code but while again changing it , it doesnot show anything
Even those integer value is not showing in app

I am not an expert in Arduino code like the hardware Power Users, but I suspect this is a data type problem.

Serial.Read gives you a char value.
Is it '0' or is it 0 ?

I don't know because I don't have access to the code on the other end of that read operation.

It would be interesting to change those

tests to

if (data == '0'){
bluetoothSerial.println("Help");

tests, since all the comparisons fail but you get digits out of the final println, which "helpfully" gives you text.

1 Like

yes thankyou i will try this

hello
can mit app inventor received the data or text which is in different language?

Yes. Use UTF-8 encoding.

we have to apply it in Arduino code only right?
(as i got to know that mit app automatically encode it).

Yes, AI2 defaults to UTF-8.

for speech to not speak repeatedly i have create a empty block to store the previous received data and have put if then condition in both text box and speech to not say the same word repeatedly but that condition doesnot work . what condition should i put there?

Where do you store global store_message?

i just make a empty set elements for it to store

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

speak_app.aia (4.2 KB)
Here at first i create a global variable to store the previous data so that it will speak one time when it receive the data but it does not work so i put if then condition in TTS.

Wrong:

Right:


(Bytes are not text)

Wrong:

Right:


(length of list works only on lists)

Thankyou for the solution.
In Text to speech i put that if condition at last because the TTs was repeatedly speaking one received data . what kind of logic should i put in TTs so that it wouldnot speak repeatedly for same received data . Even i have updated the code in python so that it will give one data for the gesture but app speak for longer period of time.like it speak for 11 or 12 times for it.



is it the correct way ?

No, comparison with a list does not work that way.

You could use the Is In List block to test before adding a phrase to the speech queue to avoid duplicating something that is already on the queue.

But if the duplication happens long after completion of all speech, that would not help.

You could try a dictionary of phrases and the Milliseconds (from 1970, default 0) when they were last spoken, and put a lower limit (one minute?) on how often they get spoken.

The technique to compare against a global variable holding the last spoken phrase should be done at the very entrance to the SAY procedure, comparing the incoming phrase against the global variable.

If they match, ignore the phrase, else set the global variable to the incoming phrase and proceed to the rest of the procedure.


i dont understand about the "dictionary " . so I use is in list block in text to speech.

Use the Do It facility to see what is in your global variables

1 Like

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