Skip to content

X4

Used only with Totem RoboBoard X4 to enable all functionality and on-board features:

  • Implements all RoboBoard X4 functionality.
  • Makes RoboBoard X4 discoverable over Bluetooth.
  • Provides direct access to TotemModule functions (Totem.X4.write("indicate")).
  • Enables passthrough to communicate with external modules connected over TotemBUS.
void setup() {
  Totem.X4.begin(); // Initialize X4 interface
}

Disabling Bluetooth

By default RoboBoard X4 makes itself discoverable over Bluetooth in order for mobile applications or other modules to connect and control it. This functionality takes a lot of space in flash memory and increases compile and upload times. If this feature isn't needed, Bluetooth can be disabled with custom initialization call Totem.X4.beginNoBluetooth(). This reduces compiled application size and allows for faster development.

void setup() {
  Totem.X4.beginNoBluetooth(); // Will utilize 50% less flash memory
}

Module monitor

X4 can monitor for each connected Totem module. This can be used for:

  • Find all connected modules
  • Get event when module is hot plugged (connected at runtime)
  • Check if module is still connected and responding
  • Get module serial number
#include "Totem.h"
// Will receive event of each module connection and ping response
void onModuleConnected(uint16_t number, uint16_t serial) {
  // Print connected module information
  Serial.print("Module connected. Number: ");
  Serial.print(number);
  Serial.print(" Serial: ");
  Serial.println(serial);
}
void setup() {
  // Start serial communication
  Serial.begin(115200);
  // Start X4
  Totem.X4.begin();
  // Register for module connection event
  Totem.X4.attachOnModuleConnected(onModuleConnected); // Register function "onModuleConnected"
}
TotemModule all(0); // Any Totem module
void loop() {
  // Request all modules on TotemBUS network to respond
  all.ping();
  // Wait 1 second
  delay(1000);
}