(EV3 robot)Ultrasonic sensor doesn't recognize distance properly

Hi, I'm creating a program that also involves ev3 mindstorm; I placed an ultrasonic sensor to recognize distance; if the distance is greater than 50cm; the robot should advance; however, if it is less, it should stop. However, the ultrasonic sensor detects distances randomly and moves whenever it wants. I'll appreciate your help. Here's the program:
imagen

Can you post a link to documentation on the EV3?

Assuming Recognizer1 is the Speech Recognizer, I see you are checking if the speech recognizer result contains the text 'Hola'.

I recommend setting a Label.Text to that result, so you can see what it heard (as opposed to what you said.

I doubt the Speech Recognizer can hear capital letters.

1 Like

I found

There are EV3 events that you don't show or you don't have.

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

export_and_upload_aia

.

with lowercase, it doesn't recognize either

the problem isn't recognization of "Hola", is the distance recognition

Have you done this ev3 tutorial to check whether the sensor is determining range with out your SpeechRecognizer code?

Is the sensor working well with the above code?

Regarding sending voice commands using the SpeechRecognizer, this tutorial shows a working way of turning a component red or green using the SR. It may help you get your sensor working correctly by coding something similar in your app.

Sometimes using two word commands works better when using the SpeechRecognizer than single word commands. Perhaps try go right instead of right; go left instead of left ? please stop perhaps rather than stop. :wink: or hola robot instead of Hola . Avoid using capital letters when you filter your SR text, sometimes your SR will 'hear' Hola but other times it will hear hola; you need to code for that possibility

What happens when you use two or more word commands like in the tutorial below? With my Android doing this allows the SR to know what to expect much better than a single word.

Thanks uwu

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