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
PlatformIO and Totem Library should be installed. If not, follow this tutorial.
- Create a new project (
+ New Project).
- Inside Explorer open project file platformio.ini.
- Add lines to the end of the file and save it:
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
Line "monitor_speed" will set Serial monitor baud to match
Line "monitor_filters" will display exact location of error if ESP32 crashes.
For more options read Project Configuration File.
- PlatformIO icon →
Examplestab, select wanted example from drop down list.
- 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.
- From here you can flash this code to board or modify it.
Arduino IDE and Totem Library should be installed. If not, follow this tutorial.
- In Arduino IDE click
- Scroll down to
Examples from Custom Libraries.
Totem Library, choose wanted project and click on it.
- 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
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.
- Controller/PS3_GripperBot - control Gripper Bot with PS3 controller.
- Controller/PS3_MiniTrooper - control Mini Trooper with PS3 controller.
- Controller/PS3_Dual_MiniTrooper - control two Mini Troopers with single PS3 controller.
- Controller/PS4_GripperBot - control Gripper Bot with PS4 controller.
- Controller/PS4_MiniTrooper - control Mini Trooper with PS4 controller.
- Controller/PS4_Dual_MiniTrooper - control two Mini Troopers with single PS4 controller.
- 4WD - example code to control 4WD robot remotely.
- Gripper Bot - example code to control Gripper Bot robot remotely.
- Mini Trooper - example code to control Mini Trooper robot remotely.
- Terminal - control any Totem board remotely from a Serial Monitor.
- Truck - example code to control Truck robot remotely.
- X3_FBI_LedBlink - example code to blink leds on X3 board remotely.
- X4_LedBlink - example code to blink leds on X4 board remotely.
- Module 11 - example code for Distance sensor.
- Module 14 - example code for Line follower.
- Module 15 - example code for Potentiometer.
- Module 22 - example code for Environment sensor.
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.