Coding
The Code section lets you program the robot in different ways.
There are three main programming modes:
Each mode is made for a different level of experience.
How to choose
- Choose
Draw-to-codeif you want the simplest way to create robot movement. - Choose
Blocklyif you want to create programs using visual blocks. - Choose
MicroPythonif you want to write code yourself.
Programming modes
Related page
Editing lines
When you tap a line, you can change how the robot drives along that part of the path.
For example, you may be able to adjust:
- speed
- acceleration
- direction
- whether the line should be removed
Editing points
When you tap a point on the path, you can change what happens at that point.
For example, you may be able to:
- adjust turning speed
- adjust turning acceleration
- delete the point
- add a robot action at that point
A point can be used to make the robot stop, turn, move its arm, play a sound, or show something on the screen.
Drawing options
The toolbar gives access to additional options:
- show measurements
- show or hide the grid
- change direction
- clear the drawing
Direct control during coding
If the robot is far away from you, you can use the driving arrows to drive it closer.
Blockly
Blockly is a visual programming mode where you create programs by connecting blocks together.
Each block represents one action, decision, or value. By joining blocks together, you create a program for the robot.
Blockly is useful when you want to teach or learn programming without writing text-based code.
When to use Blockly
Use Blockly when you want to:
- learn programming visually
- create repeatable robot actions
- combine movement, lights, sounds, and sensors
- understand programming logic step by step
- test and improve robot behavior
Running a Blockly program
Press the Play button to run the Blockly program.
As the program runs, the app highlights the block that is currently being used. This helps users understand what the robot is doing and why.
There is also a step mode. In step mode, the program runs one block at a time. This is useful for teaching, testing, and finding mistakes.
Blockly workspace
In the Blockly workspace, you can usually:
- add blocks from the toolbox
- move blocks around
- connect blocks together
- delete blocks
- zoom in or out
- center the workspace around your program
Blockly block groups
Blockly blocks are grouped by function.
Common groups include:
LogicLoopsMathTextVariableFunctionsArmBatteryCompass and OrientationDriveLightsScreenSpeakerSystem
Direct control during coding
If the robot is far away from you, you can use the driving arrows to drive it closer.
MicroPython
MicroPython is the text-based programming mode in the Dotbots app.
It is more advanced than Draw-to-code and Blockly because users write code directly.
This mode is useful for users who already understand basic programming, or for those who want to learn real coding step by step.
When to use MicroPython
Use MicroPython when you want to:
- write more detailed robot behavior
- create more advanced programs
- control the robot more precisely
- test ideas directly in code
- move beyond visual programming
Code editor
The MicroPython section includes a code editor where you can write scripts for the robot.
Dotbot-specific functions are available through the Dotbot programming library.
The editor can also help with:
- autocomplete
- type checking
- error messages
- testing code on the robot
Built-in documentation
The app includes built-in documentation for MicroPython functions.
This can help users understand:
- what a function does
- what values the function needs
- how to use the function correctly
- example code snippets
AI helper
If enabled, the app includes an AI helper for MicroPython.
The AI helper can help explain code, understand errors, and create example code.
There are two modes:
Code onlyTeacher
Terminal
The MicroPython section also includes a terminal.
The terminal lets users send commands directly to the robot and test small pieces of code quickly.
Direct control during coding
If the robot is far away from you, you can use the driving arrows to drive it closer.