Getting Started
From installation to the first movement: set up the Arduino IDE, upload a ready-made sketch and check that the robot responds. It takes about 15 minutes.
What you need
- A UniBase robot with a charged battery.
- A USB cable that carries data (a charge-only cable will not work).
- A computer with Arduino IDE version 2.
Installation
-
Add ESP32 support
In the Arduino IDE open , search for esp32 and install the esp32 package by Espressif Systems.
-
Install the UNI library
Open , search for UNI and click Install. When asked about dependencies, choose “Install all”: the library needs Adafruit GFX Library, Adafruit SSD1306 and Adafruit NeoPixel.
-
Select the board and the port
Connect the robot over USB and switch it on. Select , then the port under .
Installing from a ZIP archive
If the Library Manager is not available, download the archive from the releases page on GitHub and add it with . Dependencies are not pulled in this way: install the three Adafruit libraries through the Library Manager separately.
First sketch
-
Open the Start example
. It is a minimal program: it creates the robot and turns the screen on.
#include <UNI.h> UniBase robot; UniDev module; void setup() { robot.begin("UNI"); } void loop() { } -
Upload it to the robot
Click Upload and wait for the message that the upload has finished. The program starts right after it.
-
Look at the screen
A second later the screen shows the robot's status:
The status screen: 1 — robot name, 2 — coordinates, 3 — heading, 4 — encoder ticks, 5 — current command, 6 — battery charge. The name, zero coordinates and the word
Readymean that the screen, motors and encoders are running and the library works.
First movement
The program starts right after the upload and every time the robot is switched on. Before you add movement, put the robot on the floor or lift its wheels so that it does not drive off the table with the cable attached.
Add two commands to setup() and upload the sketch again:
void setup() {
robot.begin("UNI");
robot.moveDist(50, 300); // forward 300 mm at power 50
robot.rotate(50, 90); // turn right by 90 degrees
}
The robot drives 30 cm and turns right. X and Angle change on the screen — that
is odometry: the robot keeps track of where it is.
It is handier to start movement with a button. If a button is connected to port P5, put
module.waitButton(P5); before the movement commands — the robot will wait for a
press.
If something goes wrong
| What you see | What to check |
|---|---|
| The port does not appear in the menu | The cable must carry data. Try another cable and another USB socket. |
Error Adafruit_SSD1306.h: No such file or directory |
The dependencies are missing — the three Adafruit libraries from step 2. |
Error UNI.h: No such file or directory |
The UNI library is not installed. Repeat step 2 and restart the Arduino IDE. |
| The screen stays dark | Make sure the robot is switched on. Open the Serial Monitor at 115200 baud: if the screen is not found, the library reports it there. |
| The screen works but the robot does not move | Check the battery switch and the battery charge. |
More cases are covered in the FAQ.