-
Notifications
You must be signed in to change notification settings - Fork 0
Serial Console
- Introduction
- Starting the console
- What it is, and what it is not
- Command reference
- Live sensor streaming: watch
- Running the console over Bluetooth
- It costs nothing until you use it
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.
#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'
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.
Type help on the device for the authoritative list. Servos must be enabled before the motor commands do anything -- start with legs on.
| 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) |
| 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 |
| Command | Effect |
|---|---|
beep |
A short hello sound |
tone <hz> <ms> |
Play a tone |
mute / unmute
|
Silence or restore the buzzer |
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 |
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 |
| 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
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.
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.
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.
OttoFlow is licensed under GPL-3.0 and wraps OttoDIYLib. Buy the kits at ottodiy.com.
Prologue
Getting Started
The Basics
Digging Deeper
- Bench Testing
- Serial Console
- Calibration
- Bluetooth and the Otto App
- Modules
- The Driver
- Extending OttoFlow
Reference