Arduino Learning Studiorobotics pathway

Robot Explorers · R09-U1 and R09-U3 · usually ages 9–11, any age welcome

Robot Blocks

Build a program from blocks. Get the robot to the star.

Level 5: Keep a gap

This robot has no star sensor, only a distance sensor. Stop on the star, one square before the wall, on all three boards. You have 3 blocks.

Distance sensor: 4 squares free ahead

A pretend sensor: it counts squares exactly. A real distance sensor measures centimetres, and its readings vary.

Test table
BoardMy guessWhat happened
Anot run yet
Bnot run yet
Cnot run yet

Your program

Blocks: 0 of 3

No blocks yet. Add blocks from the list below.

Add a block

New blocks go: at the end.

Same idea in Arduino code
What it would look like · not run
// Your blocks as Arduino code.
// The lab does not compile
// or run this code.

void setup() {
  // (empty)
}

void loop() {
  // Empty. setup() runs
  // the program once.
}

This is what your program would look like in an Arduino sketch. The lab does not compile or run it: the robot here runs the blocks. The highlighted line is the block that is running.

Next, in the Arduino labs: Meet the board (setup() and loop()), Push a button (if … else with a button input) and Read a sensor (a distance sensor, in centimetres).

For the adult: level 5

What's new: New: a sensor reading compared with a number (a threshold). Distance counts the free squares in front of the robot. 'Wall ahead' is the same as distance < 1. Try 1, 2 and 3 and record what happens. A real distance sensor measures centimetres and its readings vary; here the squares are counted exactly.

It practises: Turn a measurement into a decision with a threshold. Record trials in a table.

It uses again, as blocks: Take readings with units and compare them.

Part of: R09-U3 Make Decisions. See it in the robotics pathway (opens a new tab)

How to use it: Press an add button to add a block. Press a block in the program to choose it: buttons appear under it to change it, move it up or down, put it into the block above, take it out, or delete it. When a repeat or if block is chosen, new blocks go inside it. Run plays the robot on the board shown; Step goes one action or check at a time and highlights the block (and the code line) that is running. Everything works with a keyboard and a screen reader; nothing needs dragging.

Test table: before each run, choose a guess. Afterwards, copy the table onto paper. A level counts as solved when the same program reaches the star on every board.

Before the screen: one learner reads the blocks aloud, another walks them on a taped floor grid. For "repeat until" and "if", the walker stops and checks before every move. Keep the area clear and walk slowly.

Ask, don't tell: "What will happen on board B?" "Which block was running when it bumped?" "Which line of the code is that block?"

New to this? Robot Instructions (picture cards) comes before this. Every level here is open: let a ready learner move on at any age.

Nothing is saved. The ticks and the test table last for this visit only. They are not a score.