Creating an App to control a Robot via Voice Command
Creating an App to Control a Robot via Voice Command
Today, we will see how to use voice commands to control a robot with an app.
So, the robot works with the help of an LDR and a transistor. The robot consists of two wheels controlled by an LDR and a Transistor. The robot will have a mobile stand on top of it where the phone will be placed. The phone would've a screen where two black coloured blocks turn white according to our command, and due to its whitening, the LDR detects light, and with the help of the Transistor, the wheel would start rotating, making the robot go forward, turn right and left and stop.
We won't learn how to make the robot, but we'll learn to create an app using the MIT App Inventor to control it.
What you'll need:
- A Mobile Phone
- A Laptop
Step 1: Designing the layout of our app.
First, open MIT App Inventor, click 'New Project', and then rename it.
Then, add Horizontal Arrangement from the Layout and change its width to 'Fill Parent'.
Then, add a Canvas and put it in the Horizontal Arrangement. Change its width to 'Fill Parent' and its height to 300 Pixels.
Then, scroll down and you'll see the option of uploading a file. Upload all 5 images I've provided you in this Drive link after downloading them.
After that, add 5 imagesprites from the 'Layout' and then place them in the Canvas.
In the next step, we need to change the images' widths and heights to 450 pixels and 320 pixels, respectively, for each image. Then, add the previously uploaded images in the 'Picture' option of each image sprite and then rename each one of them according to the image present in them.
After that, add another Horizontal Arrangement below and change its width and height to 'Fill Parent' and then add 2 buttons next to each other in the Horizontal Arrangement. Change their width to 210 pixels and the heights to Fill Parent.
Then, add a clock, a text-to-speech tool and a speech-recognition tool.
After that, we'll write our code.
Step 2: Writing the code for our app.
I've provided step-by-step images of the code. Add the code in that manner.
After that, click on 'Build' and then click on 'Android App(.apk)' and then you'll be able to download your app. After downloading it, you can scan the QR code to download the app on your mobile phone, too.
The App Is Ready!


















Comments
Post a Comment