Robot Logic in Scratch
Senior 3 · ICT
Robot Logic in Scratch
Lesson 1 of 5
50 min
On 14 October 2016, in Muhanga District, Rwanda launched medical delivery drones built by the company Zipline to carry blood to 21 health facilities, according to the Rwanda Biomedical Centre. A drone is launched with an order, flies itself to the hospital, drops the blood by parachute, and flies back. On the way it measures where it is, decides how to steer, and moves its control surfaces: it senses, thinks and acts. That is what makes it a robot.
In the last unit your Scratch enemy sensed the player, decided and acted on the screen. In this unit you will program the same logic for robots: first on the screen, as simulations, and then, if your school has the hardware, on real boards and motors.

Definition
Robot: a programmable machine that senses its surroundings, processes the information, and acts on the physical world, with some ability to work on its own.
Robotics: the branch of engineering and computer science that designs, builds and programs robots.
Sensor: a device that measures something in the surroundings (distance, light, touch, temperature, sound) and turns it into a signal the controller can read.
Actuator: a part that makes the robot move or act, such as a motor, a gripper or a speaker.
Controller: the robot's “brain”, a small computer that runs the program, reads the sensors and commands the actuators.
Autonomy: the ability to work without a person controlling every action.
Diagram drawn by Ganzaa.
| Part | Job | Human comparison |
|---|---|---|
| Sensors | Measure the surroundings | Eyes, ears, skin |
| Controller | Runs the program and decides | Brain |
| Actuators | Move or act: motors, wheels, grippers, speakers, lights | Muscles |
| Power supply | Batteries, solar panel or mains power | Food and energy |
| Body (chassis) | Holds and protects the parts | Skeleton |
| End effector | The tool at the end of an arm: a gripper, welder or spray nozzle | Hand |
Every robot repeats a sense–think–act loop: read the sensors, decide with the program, command the actuators, and start again, many times a second.
| Type | What it is | Example use |
|---|---|---|
| Industrial robot arm | A fixed arm with joints and an end effector | Welding, painting and assembling cars |
| Mobile robot | Moves on wheels, tracks or legs | Carrying goods in warehouses |
| Aerial robot (drone) | Flies, often on its own along a planned route | Delivering medical supplies; spraying crops; mapping |
| Underwater robot | Swims or dives | Inspecting ships, pipes and dams |
| Humanoid | Built in a human-like shape | Research, reception desks |
| Service and home robot | Does tasks for people | Robot vacuum cleaners, lawn mowers |
| Medical robot | Assists health work | Surgeons controlling very precise instruments |
| Collaborative robot (cobot) | Designed to work safely beside people | Passing parts to a factory worker |
| Educational robot | A kit for learning to build and program | micro:bit buggies, LEGO robots in classrooms |
Robots can also be grouped by control: teleoperated (a person steers it by remote control), semi-autonomous (it does some tasks itself) and autonomous (it completes its task on its own).
Worked example 1: sense, think, act
| Robot | Sense | Think (decide) | Act |
|---|---|---|---|
| Robot vacuum cleaner | Bumper touches a chair leg | “Obstacle ahead” | Reverse a little, turn, drive on |
| Delivery drone | Satellite position and air speed | “I am 200 m east of my route” | Move the control surfaces to steer back |
| Factory arm | Camera sees a part on the belt | “Part is in position, correct way up” | Close the gripper, lift, place the part |
| Automatic door | Motion sensor detects a person | “Someone is approaching” | Motor opens the door |
Is the automatic door a robot? It senses and acts, but it makes only one simple decision and does not move about. Most engineers would call it an automated machine rather than a robot. The line between them is not sharp.
Robot ethics asks how robots should be designed and used so that they help people and do not harm them. The questions grow as robots become more autonomous:
| Issue | The question | Example |
|---|---|---|
| Safety | Can it hurt anyone? | Factory arms work inside fenced cells; cobots slow down or stop when a person comes near. |
| Responsibility | Who is to blame when it causes harm: the maker, the programmer, the owner, the user? | A delivery robot knocks over a child on a pavement. |
| Privacy | What do its cameras and microphones record, and who sees it? | A home robot that maps your house and films the rooms. |
| Work | Which jobs change or disappear, and how do workers learn new skills? | Warehouse robots replacing some packing jobs while creating maintenance jobs. |
| Human control | Which decisions must always stay with a person? | Weapons that could choose targets without a human decision. |
| Honesty | Should people always know that they are dealing with a machine? | A robot or chatbot that pretends to be a person. |
| Environment | What happens to batteries and electronics at the end? | Old robots becoming e-waste. |
The writer Isaac Asimov imagined “Three Laws of Robotics” in his stories from the 1940s: a robot may not harm a human, must obey humans, and must protect itself, in that order of priority. They are fiction, not real laws, and engineers point out that real robots cannot reliably judge “harm”. Real robot safety comes from careful design, testing, standards and human responsibility.
Worked example 2: an ethics case
A school buys a robot that patrols the corridors at night with a camera and sends pictures to the bursar's phone.
A fair judgement: useful, if the school limits the camera to the night patrol, deletes pictures after a short time, posts a notice, and keeps a human guard responsible for decisions.
Thomas Arnold (Traces.Dreams): what is robot ethics? A short introduction to the questions that arise when robots work among people.
Practice
Sources and credits
This lesson adapts CC BY-SA material and is shared under CC BY-SA 4.0.