Studyfin Studyfin ✨ Sign up free

Robotics & physical computing

Grade 5 · Coding · Free lesson

Hi there! I am Studyfin, your coding buddy. Today, we will design a program to help a robot solve a real-world problem!

Robots are physical machines that need code to work. We use a design process to plan, write, and test our programs before we run them.

Programs are made of sequences and loops. A sequence is a list of steps in order, and a loop repeats steps so we do not have to write them twice.

Step 1 Repeat 3x

We also use events and conditionals. An event is a trigger like clicking a button, and a conditional lets the robot make decisions using 'if-then' rules.

IF Button Pressed THEN Light On
✏️ Worked example

Imagine a robot vacuum that needs to clean a dusty room. It must start when we press a button, move forward until it hits a wall, and then spin around to keep cleaning. Let's design this program step by step!

  1. Define the Event: We start with the event block 'When Button Pressed' so the robot knows when to wake up.
  2. Add a Sequence: Next, we add the action block 'Move Forward' right after the start event.
  3. Use a Conditional: We need to check for walls. We add an 'If-Then' block: 'If touching wall, then turn right'.
  4. Add a Loop: We want the robot to keep cleaning, so we wrap the movement and conditional inside a 'Repeat Forever' loop.
  5. Test the Code: We run the program to make sure the robot does not get stuck in a corner.
Want the full interactive lesson — quiz, animations, and Finn cheering them on?

More Coding lessons