Customization Guide
Write your own scripts to drive your Sphero Mini. You can type JavaScript directly, or drag visual blocks together — both are powered by the same Sphero API.
Getting started
- Sign in on the Sign in page so your work auto-saves.
- Pair your Sphero Mini on the Chat tab (Bluetooth must be on).
- Open the Code tab, pick JavaScript or Blocks, then press Run.
Available functions
Inside your script, you have these global functions. All return promises — use await.
await setColor(r, g, b) // 0–255 each
await roll(speed, headingDeg, durationMs) // speed 0–255, heading 0–359
await spin(headingDeg)
await stop()
await wait(ms)
Example: rainbow square
const colors = [[255,0,0],[255,180,0],[0,255,0],[0,150,255]];
for (let i = 0; i < 4; i++) {
const [r,g,b] = colors[i];
await setColor(r, g, b);
await roll(80, i * 90, 1000);
await wait(200);
}
await stop();Blocks mode
Prefer drag-and-drop? Switch the toggle at the top of the Code page to Blocks. Blocks compile to the same JavaScript shown above, so anything you build visually you can later view and tweak as code.
Saving progress
When signed in, every script you create appears in the sidebar on the Code page. Click any saved script to load it; edits autosave a moment after you stop typing.