Skip to content

Setup PlatformIO

PlatformIO PlatformIO is built on top of industry leading Visual Studio Code editor. It supports many microcontroller architectures, development boards and can utilize Arduino libraries. Furthermore, Visual Studio Code has all modern editor features like syntax highlighting, autocomplete, indexing, extensions and many more.

Step 1. Setup PlatformIO

Go to PlatformIO website to install environment for your operating system.
Make sure to check Quick Start guide.
Install PlatformIO

Step 2. Install Totem Boards

PlatformIO open new terminal

  1. Open PIO terminal by clicking PlatformIO icon PlatformIO iconMiscellaneousNew Terminal.
  2. Inside Terminal window run command and wait for it to finish:
    pio pkg install -g -p "platformio/espressif32" -l https://github.com/totemmaker/TotemArduino
Expected terminal output (click to expand)
~ $ pio pkg install -g -p "platformio/espressif32" -l https://github.com/totemmaker/TotemArduino
Platform Manager: Installing platformio/espressif32
Unpacking  [####################################]  100%
Platform Manager: espressif32@6.4.0 has been installed!
Tool Manager: Installing espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Unpacking  [####################################]  100%
Tool Manager: toolchain-xtensa-esp32@8.4.0+2021r2-patch5 has been installed!
Tool Manager: Installing platformio/tool-esptoolpy @ ~1.40501.0
Unpacking  [####################################]  100%
Tool Manager: tool-esptoolpy@1.40501.0 has been installed!
Library Manager: Installing git+https://github.com/totemmaker/TotemArduino
git version 2.33.1.windows.1
Cloning into 'C:\Users\username\.platformio\.cache\tmp\pkg-installing-_pt89bn_'...
remote: Enumerating objects: 119, done.
remote: Counting objects: 100% (119/119), done.
remote: Compressing objects: 100% (72/72), done.
Receiving objects:  94% (112/119)sed 94 (delta 12), pack-reused 0
Receiving objects: 100% (119/119), 73.74 KiB | 2.11 MiB/s, done.
Resolving deltas: 100% (15/15), done.
Totem boards installed:
C:\Users\username\.platformio\boards\roboboard_x3.json
C:\Users\username\.platformio\boards\roboboard_x4.json
Library Manager: Totem Library@1.1.2+sha.5cf56ce has been installed! 
~ $

RoboBoard X4 (only)

Update motor driver firmware to latest version. See driver update guide.

Step 3. Create project

PlatformIO new project

  1. Open PIO Home by clicking PlatformIO icon PlatformIO iconPIO HomeOpen.
  2. Click + New Project. "Project Wizard" window will open.
  3. Fill in fields:
    Name: type in any project name.
    Board: select Totemmaker RoboBoard X3 (or X4).
    Framework: select Arduino Framework.
  4. Click Finish and project will be created.
    Note: creating project first time can take a few minutes. Wait for it to finish.
  5. Open platformio.ini file and replace its content with:
    platformio.ini
    ; PlatformIO Project Configuration File
    [env:roboboard]
    ; Use Arduino with Totem software
    platform = espressif32
    framework = arduino
    platform_packages = framework-arduinoespressif32@https://github.com/totemmaker/TotemArduinoBoards
    ; Select roboboard_x3 or roboboard_x4
    board = roboboard_x4
    ; Serial Monitor baud rate
    monitor_speed = 115200
    ; Uncomment if experiencing upload issues
    ; upload_speed = 460800
    ; Decodes error message in Serial Monitor
    monitor_filters = esp32_exception_decoder
    ; Required for Serial Monitor to work
    monitor_dtr = 0
    monitor_rts = 0
    ; Enable require to use "totem" namespace with RoboBoard functions
    ; build_flags = -DREQUIRE_TOTEM_PREFIX
    
    Save file and wait for loading to finish.
  6. Inside src/main.cpp write Arduino code ant build a project.
    #include <Arduino.h> // Must include Arduino.h
    
    void setup() {
    
    }
    
    void loop() {
      RGB.color(Color::random()); // Change lights to random color
      delay(500); // Wait 0.5 second
    }
    
    Note: in case upload fails - try lower upload_speed. Available values:
    Windows: 921600 512000 256000 115200
    MacOS/Linux: 921600 460800 230400 115200

Step 4. Using PlatformIO

Now you can build and upload the code, using all Totem software features.
Remember: PlatformIO requires to have #include <Arduino.h> at the top of main.cpp file.

For more information about getting started with Arduino and PlatformIO, read following topics:

User interface:

Code documentation:

Code examples:

Question

Visit ℹ Support page to find more information or help from our community.