Lesson 3 of 4 / 7 minute read

Controllers and code

The robot’s brain is a small computer called a microcontroller. It reads the sensors, runs your program and sends commands to the motors.

The simplest programs are rules: if the distance is less than 20 centimetres, stop. Rules are easy to understand and test, and many useful robots run on little else.

Some tasks are too messy for rules, such as recognising a hand gesture from a camera. There, a small machine-learning model can be trained on examples and run on the robot. The model handles perception, while rules still decide what to do with it.

Check your understanding

When is a machine-learning model more suitable than simple rules on a robot?

Choose the answer you think is right.