Totem BLE

- Operate Totem BLE boards remotely over TotemApp service
- Supported on ESP32 (BLE capable) Arduino boards and TotemLibrary
- Available features:
- Board discovery
scan() - Control integrated features (Motor control)
- Send user defined data
sendValue(),sendString()
- Board discovery
// Control over Bluetooth
#include <TotemBLE.h> // Discover Totem boards (scan)
#include <TotemMiniControlBoard.h> // Connect Mini Control Board
#include <TotemRoboBoardX3.h> // Connect RoboBoard X3
#include <TotemRoboBoardX4.h> // Connect RoboBoard X4
TotemBLE
TotemBLE is only used to discover available boards or validate them before connecting. For actual connection and control read specific board section MiniControlBoard, RoboBoard X3, RoboBoard X4.
Boards are able to represent themselves with customizable: name, color and model (type of robot). This information is available before BLE connection is established. Same information and functionality is available using Totem App.
#include <TotemBLE.h>
TotemBLE totemBLE;
// Board found event
void onScanResult(TotemScanResult result) {
// Print discovered board information
Serial.printf("Address: '%s', Type: %s, Name: %s, Color: %x\n",
result.getAddress().c_str(), result.getType().c_str(), result.getName().c_str(), result.getColor());
}
void setup() {
Serial.begin(115200);
// Register result function
totemBLE.addOnScanResult(onScanResult);
// Start scan for available Totem Boards
totemBLE.scan();
}
void loop() { }
Scan function
Begin BLE scan() and receive discovered results from addOnScanResult().
totemBLE.addOnScanResult(
function) ¶-
Register function to receive discovered scan results
TotemScanResult.
Parameter:
function-void onResult(TotemScanResult result)
status totemBLE.scan()
¶
statustotemBLE.scan(duration) ¶-
Start Bluetooth scan for Totem boards. Results will be received in function registered with
addOnScanResult().
Parameter:
duration- amount of seconds to scan. [0] infinite.
Returns:
status- [true] scan is started, [false] failed to start. totemBLE.stop() ¶
-
Stop ongoing Bluetooth scan.
statustotemBLE.isScanning() ¶-
Check if ongoing Bluetooth scan.
Returns:
status- [true] scanning, [false] not scanning. totemBLE.wait() ¶
-
Wait (block) until scan is stopped by
durationor manually withstop().
TotemBLE totemBLE; void setup() { totemBLE.scan(); totemBLE.wait(); // Code execution is held by "wait" function, until scan is stopped }
Find function
Begin BLE scan looking for specific board. Result will be returned once discovered.
TotemScanResult totemBLE.findAny()
¶
TotemScanResulttotemBLE.findAny(name) ¶-
Discover any Totem board (block until found).
Parameter:
name- (optional) find board with matching name.
Returns:
TotemScanResult- scan result object.
TotemScanResult totemBLE.findMiniControlBoard()
¶
TotemScanResult totemBLE.findRoboBoardX3()
¶
TotemScanResult totemBLE.findRoboBoardX4()
¶
TotemScanResult totemBLE.findMiniControlBoard(name)
¶
TotemScanResult totemBLE.findRoboBoardX3(name)
¶
TotemScanResulttotemBLE.findRoboBoardX4(name) ¶-
Discover specific type of Totem board (block until found).
Parameter:
name- (optional) find board with matching name.
Returns:
TotemScanResult- scan result object. TotemScanResulttotemBLE.findAddress(address) ¶-
Discover Totem board matching Bluetooth address (block until found).
Parameter:
address- address Bluetooth address to find.
Returns:
TotemScanResult- scan result object.
TotemScanResult
addressresult.getAddress() ¶-
Get board Bluetooth address.
Returns:
address- String object containing address nameresult.getName() ¶-
Get board name.
Returns:
name- String object containing name colorresult.getColor() ¶-
Get board appearance color.
Returns:
color- 24-bit HEX color colorresult.getModel() ¶-
Get board appearance identifier.
Note: Not used at the moment.
Returns:
color- 16-bit identifier numberresult.getNumber() ¶-
Get board identification number.
Returns:
number- 8-bit id typeresult.getType() ¶-
Get board type name.
Returns:
type- String of [Mini Control Board,RoboBoard X3,RoboBoard X4]
status result.isMiniControlBoard()
¶
status result.isRoboBoardX3()
¶
statusresult.isRoboBoardX4() ¶-
Is board of specific type.
Returns:
status- [true:false]