Click & Whirr needs a wider screen
Open it on a laptop or desktop (1280px or wider recommended). The Learn · Code · Watch workspace needs the room to breathe.
Lesson 01
Differential drive
A two-wheeled robot steers by spinning each wheel at a different speed. Match the speeds and it rolls dead straight; speed up one wheel and it arcs toward the slower side; spin the wheels in opposite directions and it pirouettes in place. Feel it with the sliders, then make it code: your drive function gets the clock and the goal bearing, and owns the wheels.
Checkpoints
- Roll dead straight (waiting for Run)
- Spin in place (waiting for Run)
- Park on the green goal (waiting for Run)
Press Run ▸ to start checking your code.
The sliders are a sandbox: play, then press Run. Checkpoints only count once your code is driving: fill in the three phases (straight, spin, head for the goal).
Steps
- 1
Make it roll
Phase 1 (
t < 3): the same speed on both wheels rolls dead straight. - 2
Make it spin
- 3
Park on the goal
▸API reference
- drive(t, goal_bearing)
- Called every tick. t = seconds since Run; goal_bearing = angle to the goal in radians (+ = the goal is to your left). Return a (left, right) tuple.
- wheel speeds (-100..100)
- Equal speeds roll straight; opposite speeds spin in place; unequal speeds arc toward the slower wheel.
- the sliders
- A sandbox: before your first Run they drive the robot so you can feel the mapping. Once your code compiles, it owns the wheels. Checkpoints only count for the code.
space pause · r reset
Simulator
Sandbox: the sliders drive the robot until your first Run. After that your code owns the wheels, and only code earns checkpoints.