The main idea consist in connecting an Android device to a bluetooth client with the intention of controlling it. This micro-app is the beginning of a Six Servomotor Controller application that will be used to control Armdudroid.

This application is perfect to connect an Android device to Linvor BT Module for Arduino

This application could be interesting to start a bluetooth connection with any microcontroller and control it, for example, you can connect it to Arduino and switch ON a light sending a byte, or you could move a servomotor sending the exact position, or whatever! So thinking about it, this is the conclusion:

Necessary Knowledge
23%
Duration
32%
Usefulness
84%

It is worth!

APP Inventor or AI is a powerful and so easy-to-use tool for creating Android applications with lot of features and in no time. It  is an application originally provided by Google, and now maintained by the Massachusetts Institute of Technology (MIT).

While creating an AI application two different parts are developed; the screen objects and the blocks. On the Screen there are the following objects:

Bluetooth APP inventor Screen

Elements on screen in Bluetooth connection

Some info:

  • The ActivityStarter as_TurnONBT has this code in the Action textbox: android.bluetooth.adapter.action.REQUEST_ENABLE
  • The ActivityStarter as_Pairdevice has android.intent.action.MAIN in Action textbox, com.android.settings.Settings$BluetoothSettingsActivity in ActivityClass textbox and com.android.settings in ActivityPackage.
  • All elements are full width and Enabled.

Some tips are:

  • Use always screen arrangements for any part of the application. You never now when will you want to hide the pack of items.
  • Rename any element or object with its class before, like the Button1 to bt_Connection. They will be organized in the Blocks Editor.
  • Set to full with any element. If they are fixed width probably there would be devices not able to open the application or to show all the content.
  • Use buttons as labels, they look cooler. Sometime it is necessary to show an ON/OFF label or Connect/Disconnect or labels which change properties, but labels in APP inventor are not stylized so using a button will be better.

Now the blocks:

Bluetooth Connection Whatakuai

Bluetooth connection blocks

Features:

  • Bluetooth enabling if disabled.
  • Bluetooth pairing if not devices paired.
  • Auto-connection when initialized if a paired device is available and bluetooth is enabled.
  • Notifiers to warn the user some issues.
  • ON/OFF label to show the status.

 

Download APP Inventor Bluetooth Connection source by clicking below:

UPDATE: NOW BLUETOOTH CONNECTION FOR APP INVENTOR 2 (AI2)

Now SIMPLER but with THE SAME FEATURES!

Open in new tab

.AIA Blocks

 

DOWNLOAD .AIA SOURCE CLICKING BELOW:

Or HERE