====== Using A Bluetooth Serial Console on Your Android Device to Send Console Commands to Your MiTail ====== ===== Getting The App ===== Find and install [[https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal|Serial Bluetooth Terminal]], by Kai Morich in the Play Store. {{:en:dev:serial_bluetooth_terminal.jpg?nolink&300|}} Note that any tool that can send data to Bluetooth Low Energy (BLE) devices is suitable for use. Another free tool that has greater capability (and complexity) is [[https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp|nRF Connect for Mobile]] by Nordic Semiconductor ASA. For this tutorial, we'll walk through the simpler, but also free, tool. ===== Connecting ===== To connect to the tail console, first turn the tail on and make sure the blue light is on and at a slow blink, indicating it is ready. Open the Serial Bluetooth Terminal application and select the hamburger menu icon in the upper left corner. This will pop out the main menu. {{:en:dev:terminal.jpg?nolink&300|}} Select "Devices", then long-press the device named "mitail". A pop-up menu will appear (*Connect" or "Edit") alongside it, choose "Edit". (A short press on the device will start the connection process, which will fail with an error if the connection characteristics have not been previously set as in the following steps. Once the connection characteristics have been set for a particular device ID, they shouldn't need to be set for subsequent connections.) {{:en:dev:dt-devices.jpg?nolink&300|}} When "Edit" is selected, a new menu will open. For each field, select the field, and a dialog will appear with the available characteristic IDs for that field. Select the IDs as shown below. For the Service UUID ("3af2108b-d066-42da-a7d4-55648fa0a9b6") and Write characteristic UUID ("5bfd6484-ddee-4723-bfe6-b653372bbfd6") there will be only one choice. The Read characteristic UUID must be selected as "c6612b64-0087-4974-939e-68968ef294b0". Press the checkmark in the upper right of the menu bar to close and save the settings. {{:en:dev:profile.jpg?nolink&300|}} The application will return to the Devices menu. {{:en:dev:dt-devices.jpg?nolink&300|}} Select the "mitail" device you just edited (or long-press to open the context menu and select "Connect"). The menu will close, and you'll see the terminal attempt to connect. {{:en:dev:dt-connected.jpg?nolink&300|}} If the attempt fails (such as the tail is not on or ready), a "Connection failed" message will be produced and the connector icon in the top menu bar will show two disconnected plugs. {{:en:dev:connect_failed.jpg?nolink&300|}} Click the two disconnected plugs to restart the connection process. When it's completed, the tail's serial console is available, and simple text commands can be sent. ===== Sending Commands ===== Commands are case-sensitive. In this example, the command "VER" is sent, and the reply is "3.2.11". {{:en:dev:dt-ver.jpg?nolink&300|}} In this example, the command for a user-defined LED pattern is saved to Slot 1 using "USERLEDS U1P2N4A8A0S5S45", with the reply "OK". The pattern is then commanded with "LEDUS1", with response "BEGIN LEDUS1 END LEDUS1" {{:en:dev:ledus1.jpg?nolink&300|}} Macros can be set by pressing and holding any of the M1 through M7 keys. A macro is sent by merely tapping the respective key. ===== Additional Commands ===== Refer to the MiTail Tail Protocol documentation for additional commands and command syntax. Caution: Short rapid changes of direction may wear down internal servo horns and cause excessive heat. Additionally, holding a move, where both servos are engaged for long periods, should similarly be avoided. == Copyright 2023 © The Mechanical Tail Company Limited contact@thetailcompany.com. All Rights Reserved. ==