Previously we developed the TalkToMe app, which allows us to employ the capabilities of smart and mobile devices in App Inventor mit, using AcceleometerSensor and Text to Speech features.
We can upgrade the TalkToMe app to respond to other user events, like shaking the phone, so the app talks to the user and says "Stop shaking me!".
app inventor mit talkTome app upgrade
In this app you will learn how to use AcceleometerSensor and Text to Speech features, and employ them in your app inventor mit app.
App Objectives
- Use some features of modern smart devices, such as the Text to Speech feature.
- Using a smartphone (AcceleometerSensor).
App Tools
Tool 1: AcceleometerSensor
Palette: Sensors
Name: AcceleometerSensor
Use: used to sense the movement of the mobile device.
Tool 2: text to speech
Palette: Media
Name: text to speech
Use: used to read the selected text.
Tool 3: Button
Palette: User Interface
Name: Talk to Me
Use: to show the user "Halloo World" in the title element.
Steps
1. Open talk to me app in appinventor mit.
2. Go to the designer screen.
3. Drag the acceleration sensor tool from the Sensors category in the panels, and drop it on the screen, to appear at the bottom of it.
4. Go to the blocks mode by pressing the (Blocks) button.
4. Click on the AcceleometerSensor item at the bottom of the block list, all button events will appear in the viewer.
5. Drag the sensor change event block (When AcceleometerSensor1.Shaking) to appear in the block formation space on the right.
The sensor change block appears in the scene.
6. Click on the TextToSpeech1 item in the Blocks panel.
7. Drag the Call TextToSpeech1.Speak message event and place it on the scene inside the sensor change event.
8. The sensor change event becomes:
9. Click the Text category in the Blocks list, then drag the text string variable to the end of the Call TextToSpeech1.Speak message block, so it becomes as follows:
With this, the application is complete.
App Blocks
App Preview
1. Choose Al companion command from the Connect menu.
2. Point the phone's camera at the code that will appear on the screen, and press the (Scan QR code) button to launch the application on the phone.
3. Click the (Talk To Me) button in the app to hear the text "Congratulations! You've made new app." from the smart device.
4. Shake the phone to hear a "Stop Shaking Me!" sound from it, and the sound stops when you stop moving the phone.