Skip to content

Serial Console

Ahmed Dabak edited this page Jul 25, 2026 · 2 revisions

Serial Console

Introduction

The serial console lets you exercise every motor and every sensor from the Serial Monitor, live, without editing and reflashing a sketch. It is the tool the whole Bench Testing workflow is built around.

Starting the console

#include <OttoFlow.h>

void setup() {
  OttoFlow::start();
  Console::begin(9600);
}

void loop() {
  Console::poll();
}

Console::poll() must run every loop() iteration; it handles one command per call. Open the Serial Monitor at the same baud rate, type help, and press Enter.

OttoFlow 0.1.0 test console - type 'help'

What it is, and what it is not

The console is a hardware test tool: one motor, one sensor, one command at a time. It deliberately does not offer gestures, dances, or walking.

That restraint is on purpose. Full, expressive control belongs in your program or in the official Otto DIY phone app (see Bluetooth and the Otto App). The console's job is narrower and more useful: prove that each individual part is wired and working, so that when a behaviour misbehaves you already know the hardware underneath is sound.

Command reference

Type help on the device for the authoritative list. Servos must be enabled before the motor commands do anything -- start with legs on.

Sensors (one-shot)

Command Shows
dist Distance in cm, or out of range
touch touched / not touched
light Brightness percent
mic Peak loudness percent
tilt Pitch and roll in degrees (needs the MPU-6050)
accel Acceleration x, y, z in g (needs the MPU-6050)

Matrix

Command Effect
mouth <name> Show an icon: heart happy smile sad angry surprised confused tongue ok x question line
digit <0-9> Show a single digit
text <message> Scroll a message
bright <0-15> Set brightness
clear Blank the display

Buzzer

Command Effect
beep A short hello sound
tone <hz> <ms> Play a tone
mute / unmute Silence or restore the buzzer

Motors

Enable a group first with legs on or motion on.

Command Effect
legs on / legs off Attach or detach the four leg servos
motion on / motion off Attach or detach all servos, legs and arms
home Send the legs to the rest position
leg l|r <0-180> Move one leg (hip) servo
foot l|r <0-180> Move one foot servo
arm l|r <0-180> Move one arm servo (needs arms enabled)
arms on / arms off Hold or relax the arm servos
arms center Send both arms to 90, the arm rest position (arms home also works)
arms up / arms down Both arms straight up / down at the sides (mirrored angles)
center Send all leg servos to 90, the calibration reference
pose <ll> <lr> <fl> <fr> [ms] Move all four leg servos to a stance, smoothly

Calibration and info

Command Effect
trim <ll> <lr> <fl> <fr> Set servo trims and show the result immediately (not yet saved)
trim save Store the current trims in EEPROM
version Print the framework version

A calibration session looks like this -- see Calibration for the full walk-through:

> legs on
> center
> trim -4 3 0 -2
> trim save
trims saved

Live sensor streaming: watch

A one-shot dist is a snapshot. watch turns a sensor into a live feed, which is what you want while physically waving a hand or tilting the robot:

> watch dist
watch dist on
dist 40cm
dist 22cm
dist 8cm
> watch off
watch off

watch toggles each sensor independently, so you can follow several at once:

> watch dist
> watch tilt
dist 30cm  pitch -2 roll 1
Command Effect
watch dist|touch|light|mic|tilt|accel Toggle that sensor's live stream
watch off Turn every stream off

The stream is throttled to at most two lines per second and prints only when a value changes, with a keep-alive line every two seconds so you know it is still running. tilt and accel require the MPU-6050 to be connected and enabled; the console tells you if it is not.

Running the console over Bluetooth

The console works over any stream, not just USB. Wire and enable a Bluetooth module, then point the console at it:

OttoConfig cfg;
cfg.bluetooth.enabled = true;
OttoFlow::start(cfg);
Console::begin(Bluetooth::stream());

Now you can bench-test a robot that is untethered -- on the floor, mid-walk, across the room. See Bluetooth and the Otto App.

It costs nothing until you use it

If a sketch never calls Console::begin(), the linker strips the entire console from the binary. Including it in every project is free -- you only pay in flash for the console when you actually start it.

Clone this wiki locally