Skip to content

Use example projects

Totem Library comes with example projects to brief about usage of main functionality or provide a code required to run a specific robot. It can also be a starting point to modify the code from a working robot in order to add additional functionality.

Using example code

Note

PlatformIO and Totem Library should be installed. If not, follow this tutorial.

  1. Create a new project (PIO HomeOpen+ New Project).
  2. Inside Explorer open project file platformio.ini.
  3. Add lines to the end of the file and save it:
    monitor_speed = 115200
    monitor_filters = esp32_exception_decoder
    monitor settings
    Line "monitor_speed" will set Serial monitor baud to match Serial.begin(115200).
    Line "monitor_filters" will display exact location of error if ESP32 crashes.
    For more options read Project Configuration File.
  4. PlatformIO icon → PIO HomeLibraries → Tab Installed → select Totem Library.
  5. In Examples tab, select wanted example from drop down list. Example select
  6. Copy all example code and paste it to src/main.cpp file (located in Explorer).
    Note: click View → Explorer if you don't see project files list.
  7. From here you can flash this code to board or modify it.

Note

Arduino IDE and Totem Library should be installed. If not, follow this tutorial.

  1. In Arduino IDE click FileExamples.
  2. Scroll down to Examples from Custom Libraries.
  3. Select Totem Library, choose wanted project and click on it.
  4. A window will open with selected project. From here you can flash this code to board or modify it.
    If modifying an example project - Arduino IDE will ask to save it as a new project.

List of example projects

BLE

Projects utilizing Totem.BLE.begin() to connect and control Totem modules remotely. These examples can be used with any ESP32 based development board. For more information read - Use third-party boards.

Module

X4

Projects build specifically for RoboBoard X4. They must be used with Totem.X4.begin() to utilize all board functionality.

  • Controller/PS3_Truck - control Totem Truck with PS3 controller.
  • Controller/PS4_Truck - control Totem Truck with PS4 controller.
  • EasyStart - example code template for RoboBoard X4 programming.
  • Empty - minimal required code for RoboBoard X4 to run. Used when you need to control robot from smartphone only.
  • LedBlink - example code to blink RGB leds on X4 board.
  • Terminal - control RoboBoard X4 manually from a Serial Monitor.
  • Truck - example code to control Totem Truck robot.