- I decided to use the MIT APP INVENTOR to build my Application because it is easy to use and interact with via a simple graphical interface. If you are new to MIT APP INVENTOR you can go through THIS TUTORIAL to know the basics.
WHAT IS MIT APP INVENTOR?
App Inventor for Android is an open-source web application originally provided by Google, and now maintained by the Massachusetts Institute of Technology (MIT). It allows new comers to computer programming to create software applications for the Android operating system (OS).
It uses a graphical interface, very similar to Scratch, which allows users to drag-and-drop visual objects to create an application that can run on Android devices.
In creating App Inventor, Google drew upon significant prior research in educational computing, as well as work done within Google on online development environments.
- Download the installer from THIS LINK .
- Locate the file AppInventor_Setup_Installer_v_1_2.exe (~92 MB) in your Downloads file or your Desktop, open the file and click through the steps of the installer.
- Open your browser and go to THIS LINK then logon.
HOW MIT APP INVENTOR WORKS?
- MIT APP INVENTOR Platform has 2 main views and you can switch between them:
- DESIGNER VIEW: where you can make the Interface and the design of the application.
- BLOCKS VIEW: where you can add the functions of the application.
- IN DESIGN VIEW: you will find the components menu where you can reach add components to your interface and you can change their properties by clicking on them and changing them from properties menu.
- From the top menu: Go to "Projects" -> "Start New Project" .
- In Designer View - we need to add some buttons to find and connect to our board over Bluetooth as follows: .
- Drag a HorizontalArrangement from the Layout drawer in the Palette and add "ListPicker" and "Button" to it.
- Rename the ListPicker: "ListPickerScan" and the button "ButtonDisconnect".
- Change their text to "Scan" and Disconnect".
- Below the Horizontal Arrangement add a Label and rename it "LabelStatus" and change its text to "Status: ".
- Drag a VerticalArrangement from the Layout drawer in the Palette and add 2 Buttons to it.
- Rename the 2 buttons "ButtonOn" and "ButtonOff".
- Change their text to "ON" and Off".
- Below the Vertical Arrangement add a TextBox and rename it "TextBoxReceived".
- From the Palette -> "Connectivity" -> Drag "Bluetooth Client", After it is are dragged onto the Viewer it will appear below the main screen, since it
is a non-visible component and get the name "BluetoothClient1"
- From the Palette -> "Sensors" -> Drag "Clock", After it is are dragged onto the Viewer it will appear below the main screen, since it
is a non-visible component and get the name "Clock1"
- In Block View - We want to set up the application to scan for available Bluetooth devices to show them in the ListPicker , connect to the bluetooth device we select and finally to send "1" when we click on "ButtonOn" and "0" when we click on "ButtonOff" . To do this, we will do the following:
- To Pre-populate the ListPicker by the bluetooth devices, From the Blockes pane build the blocks below.
- Then add the blocks below to: connect to the Bluetooth device selected then change the status label to "Connected".
- I also added the following blocks to disconnect the bluetooth device and change the status label to disconnected.
- To enable the "ButtonON" and "ButtonOff" buttons to send "1" amd "0" respectively add the blocks below.
- Finally, to receive the incoming feedback from the Bluetooth device (i.e: The text sent from the HC-05 TX), I added the blocks below.
- Now time came to upload your program to an android device to do so you need to follow the following steps or you can go to THIS LINK for more details:
- Download and install the MIT AI2 Companion App on your phone.
- Connect both your computer and your device to the SAME WiFi Network.
- Open an App Inventor project and connect it to your device.
- In the project you created -> Go to top menu -> Choose "Connect" and "AI Companion"
- A dialog with a QR code will appear on your PC screen. On your device, launch the MIT App Companion app just as you would do any app. Then click the “Scan QR code” button on the Companion, and scan the code in the App Inventor window
- Within a few seconds, you should see the app you are building on your device. It will update as you make changes to your design and blocks, a feature called “live testing”.