Use mBot with App Inventor (V1.9)

MIT App Inventor is a drag-and-drop block-based editor which can make Android Apps. You can use App Inventor to control mBots through an extension.

This document is available in a .docx document.

 

What’s new in Version 1.9

  • Uses Bluetooth 4.0 (BLE), which simplifies the connecting experience. Now you may connect your mBot with even only one button.
  • Added support for 9g mini servo
  • Now sensor values are read through events, easier for programming.

Add the mBot Extension to MIT App Inventor

MIT App Inventor is a drag-and-drop block-based editor which can make Android Apps. You can use App Inventor to control mBots through an extension.

Step 1. Go to MIT App Inventor’s website; create or open a project.

Step 2. In the Extension category of the Palette, click Import Extension. And switch to the URL tab in the opening dialog box.

app-inventor-1

Step 3. Paste the following link to the text box, and click Import.

http://appinventor.makeblock.com/MBot_v1.9.aix

ai-paste-link

Step 4. Click OK in the Rename extension dialog.

ai-rename

 

Step 5. Now you can see mBot in the Extension category. Drag it onto your phone screen.

 

  

Connect to a mBot with your Android App

Whenever you want to connect the robot, use the Connect to robot block.

Your phone will start searching for the nearest robot and connect it if close enough.

Tip:
If you run “Connect to robot” block again, the phone will close the previous connections and try to connect again.

Tip:
If you cannot connect the robot, please check: 1. Whether Bluetooth on the phone is enabled; 2. Whether the robot’s power is on. And of course, your phone needs to support Bluetooth 4.0.

 

Issue commands to your robot

After the robot is connected, commands regarding to motors, lights, sound and servos become available.

Here is an example of telling the robot to move forward when the button is clicked:

ai-example-move

Read Sensor Values

In version 1.9, you need to “open” a sensor first, then use the sensor values in “received sensor value” blocks.

ai-example-readsensor

For example, the following blocks “open” the ultrasonic sensor when the mBot is connected:

ai-example-readsensor2

Then you can use the sensor value in the “when mBot receive ultrasonic value” block. This is an example of obstacle avoidance:

List of Blocks

See the doc document

 

3 thoughts on “Use mBot with App Inventor (V1.9)”

  1. Hi,

    I’m a new user. I have an inventor Kit. I would like just to test all the functions available using Mit App inventor.
    The starter extension is setup and the bluetooth connexion is working.

    I just try this function in the App inventor side.
    starter1.DisplayNumberOn7Segments (Port 6, Number 999). I saw that something is received on my Orion board.
    My question is how can I manage this function in my orion board.
    Do you have an example for Orion board inventor Kit working with Mit App Inventor.

    Regards

    André

Leave a Reply

Your email address will not be published. Required fields are marked *