Skip to content

First Application

Rhomb.IoT by default includes support for many networks (WiFi, GPRS), sensors and peripherals. Usually it is not required to write code to create an application, but select the correct configuration on the conf-user.h

On this page you can see the file estructure of the project and a minimal main.cpp file to start an application.

File Structure

If you followed the steps at the Getting Started you should have an instance of VS Code opened with the folder project.

The file structure is similar to this:

├── lib/
│   └── rhomb.iot/
|       ├── data/
|       ├── docs/
|       ├── src/
|           └── rhomb.iot.h
|           └── [...]
├── src/
│   └── main-arduino.cpp
│   └── main-mbed.cpp
├── test/
|   └── [...]
└── platformio.ini

There are two main files, one for Arduino and Other for Mbed OS. One will be automatically selected at compile time. You can start editing this main files or remove them and create your own main.cpp like this:

// src/main.cpp
#include <Arduino.h>

#include "rhomb.iot.h"

void setup() {

void loop() {

That's it! now it's time to compile and flash our project. If you want to know what happens behind the scenes of this main.cpp see the life cycle of the application in the developers docs.

Configure conf-user.h

The file conf-user.h contains all the configuration values available. Please read the manual for the User Configuration

Compile and Upload

At the bottom of VS Code there is a toolbar with some options:

Platformio dialog box new project
  1. Connect your device to the computer with the USB cable
  2. Look at the COM port assigned to your device by your computer and configure the file platformio.ini
  3. Push the build button or upload. Upload will also do a build.
  4. If all is OK your device is ready, open the serial monitor and you should see an output like this:
RHOMB.IOT - The Modular IoT Firmware
       version 0.1.0

[I] 0 setup MAIN interruption on pin: 0
[I] 0 INIT ESP32 SPIFFS Memory
[I] 0 Rolling Log File
[I] 0 INIT Timer
[I] 0 Use default config - Version: 1
[I] 0 [info] Previus config loaded
[I] 0 SET Opmode: 1
[I] 0 SET new device ID: 4245060915
[I] 0 INIT device
[I] 1 SET Opmode: 1
[I] 2 Enable WiFi
[I] 2 home: 1111aaaa
[I] 2 Trying to connect WiFi...: 255
[I] 3 Wifi Connected
[I] 3 SET Opmode: 4