Robot Simulator
Program a 2-wheel robot with blocks or code. Follow lines, avoid walls, solve a maze. Free, no account. Nothing is sent anywhere.
Your blocks as code (this is how they look in Python):
Your achievement card (made on this device):
The card has no name on it. Ask a grown-up before you post anything online.
Words the robot understands
| Write | What it does |
|---|---|
forward(20) · back(20) | Drive forward or back 20 cm. The wheels count how far they turned (encoders). |
left(90) · right(90) | Spin in place 90 degrees. |
motors(50, 30) | Left motor 50 %, right motor 30 % (from -100 to 100). They stay on until you change them. |
wait(1) · stop() | Wait 1 second · turn the motors off. |
distance() | Distance sensor (like an ultrasonic one): cm to the nearest thing in front. |
line_left() · line_right() | 1 if that line sensor sees the line (or the ring's white edge), else 0. light_left() and light_right() give the reflected light, 0 to 100. |
bump() · heading() · time() | 1 if it hit something · compass heading in degrees (turning right makes it bigger) · seconds since the start. |
repeat 4: · while true: · if … elif … else · for i in range(4): | Loops and decisions. Lines inside get 4 spaces. Each turn of a loop takes 0.02 s of robot time, like a real robot. |
x = 5 · say(x) | Variables and messages. You can use + - * / % and, or, not. |
How the robot moves (the math)
It is a differential-drive robot: two motor wheels and a caster. If the left wheel goes vL and the right wheel vR (cm/s), and the wheels are L = 11 cm apart:
- forward speed v = (vR + vL) ÷ 2
- turning speed ω = (vR − vL) ÷ L (radians per second)
- equal wheels = straight line; opposite wheels = spin in place.
The simulator uses the exact arc formula every 0.02 s step. Real-world mode adds sensor noise and makes one wheel slip 3 %: that is why real robots need sensors and feedback.
📘 Learn it all in the Robots from Zero course · 🛠️ Maker Lab projects
Privacy: your solved challenges and your code are saved only in this browser. Nothing is sent anywhere.