Teaching middle schoolers programming loops with FTC blocks
Middle school students often meet loops in maths as repeated number patterns, but robotics makes the idea physical. A robot crossing a taped square, scanning for a target, or repeatedly checking a sensor gives repetition an immediate purpose. With FIRST Tech Challenge (FTC) blocks, learners can arrange commands visually, test them on a robot or simulator, and revise mistakes without first memorising programming syntax.
The goal is not simply to make a block repeat. Students should identify a loop body, repetition rule and termination condition, and recognise each pass as an iteration. A strong lesson moves from an unplugged sequence to a fixed-count loop, then to sensor-driven automation. Students also need language for explaining why the robot behaved as it did, so a successful run becomes useful computational thinking rather than a lucky trial.
Why loops matter in middle school robotics
Loops are valuable because robots repeat actions under changing conditions. Without them, a long route needs dozens of near-identical blocks, which makes code difficult to inspect and revise. A loop condenses the pattern while keeping each move visible: drive, turn, wait, check and repeat.
For learners aged about 11 to 14, block-based programming offers a manageable path from physical sequences to abstract logic. Students can see the control structure, discuss cause and effect, and link engineering decisions to program behaviour. FTC blocks also let a teacher change motor power, distances or sensor values quickly while the class tests ideas.
Teaching should separate three ideas: repeating a known count, repeating until a condition changes, and responding continuously to events. Not every repeated movement needs a loop; sometimes a clear sequence is safer. The aim is purposeful automation, not simply packing commands into fewer blocks.
Turning repeated robot actions into block code
A fixed-count repeat suits a route with a known number of actions. For a square path, students place driving and turning commands inside a repeat block set to four, then alter the count to test the rule. This makes the loop body and counter visible and gives them an immediate reason to revise parameters.
Conditional blocks add greater control. With a repeat-until or while-style pattern, a robot can move while a distance sensor remains clear, collect until an object is detected, or stop before a boundary. Students must also learn that conditions can already be true, sensors can fluctuate and a loop can never finish; a time limit or emergency stop prevents a stalled chassis.
A forever loop can coordinate continuous control while conditional branches decide what happens next. For a playful extension, the premise of a hidden object challenge can inspire a search routine: sweep the field, stop when the target is detected, and exit after one confirmation. This turns repeated scanning into a purposeful state change.
Moving from unplugged activity to programmed motion
Start on the floor before opening the coding environment. Tape a route, assign students the robot’s movements, and have them write or act out pseudocode. When the physical route works, transfer each action to a block. This separates motor control from loop logic and keeps an early coding failure from looking like a driving failure.
Work in pairs with rotating roles: one student predicts and drives the test, while the other builds blocks and records results. Run cards can require students to state the loop count, condition and expected exit behaviour before testing. A simulator or taped field then provides the same safe feedback loop for every team.
Increase complexity only after students can explain the simple version. A later challenge might count attempts with a variable, adjust a threshold after repeated sensor readings, or place one command inside another loop. Introduce timers and nesting separately, because several new concepts at once can hide a basic termination error.
Teaching, testing and troubleshooting with students
Use a predict-run-observe-explain routine. Before running, students sketch the expected path and identify what should make the loop finish. Afterwards, they compare prediction with evidence. This simple cycle develops debugging discipline and helps teachers distinguish a coding misconception from an inconsistent sensor reading or mechanical problem.
Common errors include placing a command beside rather than inside a repeat block, using an off-by-one count, and writing a condition that starts true. Ask students to inspect attached blocks, display sensor values, count passes and temporarily slow motor speed. One change per test produces clearer reasoning than rapid trial and error.
Offer accessible pathways with colour-coded blocks, spoken explanations, driver and coder roles, or a partly completed sequence for students who need a starting point. End with an exit ticket asking for a loop body, its stopping rule and one likely fault. Keep tests slow, use a reachable emergency stop and limit continuous motor runs.
Adapting the lesson for Australian schools
In Australian schools, middle school usually means Years 7 and 8. Term dates vary by state: some begin in late January and others in early February, while public holidays can alter the sequence. Build the lesson around the state school calendar rather than copying a Maryland timetable, and place the activity early enough for a second test.
January is Australian summer, and daylight saving in southern states can shift after-school pickup times. Check sunset, transport and supervision before scheduling evening robot sessions. A lunchtime option may suit one school, while an after-club slot works better where buses run later.
Melbourne, Brisbane, Perth, Adelaide and Canberra each provide routes into local school and community robotics networks. Regional and remote schools near places such as Alice Springs may rely more on online mentoring, making downloadable block activities and scheduled video debugging especially valuable. Shipping parts or bringing mentors to these areas can be expensive.
Australian classroom conversations are often direct and friendly, so phrases such as “give it a go” and “that code has gone a bit weird” fit a collaborative tone without replacing technical vocabulary. Sponsorship requests should name the school, budget in Australian dollars, and connect the program to outcomes such as teamwork, engineering skills and community events.
Preparing a term of loop-focused learning
Maryland FIRST Robotics, a nonprofit operational partner for FIRST, supports students aged 4 to 18 through FIRST Robotics Competition, FIRST Tech Challenge, FIRST LEGO League and Jr.FLL. Its public events calendar shows how meetings and competition events can be organised in one visible schedule. Australian coordinators can mirror that rhythm through FIRST Australia, state activities and local school holidays rather than treating overseas dates as local ones.
Back in the classroom, use one robot and three progressively harder challenges so every team can leave with working code. Track iteration counts, faults found and revisions made; these provide better evidence of learning than the number of successful demonstrations alone.
| Block pattern | Best suited to | Example FTC behaviour | Main teaching check |
|---|---|---|---|
| Fixed-count repeat | A known number of actions | Trace four sides of a square | Keep every action inside the loop |
| Repeat-until or while | A sensor condition | Drive until a boundary is detected | Show how the loop must end |
| Forever with conditions | Continuous control and events | Check the game state and select an action | Prevent accidental infinite running |
A practical preparation checklist keeps the session productive and safe:
- Choose a meaningful robot job before opening the blocks environment.
- Have students predict the loop count, body and exit condition before each run.
- Teach fixed-count, condition-based and event-controlled loops separately.
- Rotate pair roles so every student explains, tests and revises code.
- Add a timeout, slow-speed setting and reachable emergency stop to every test.
- Use the exit ticket to plan one change for the next iteration.
Choose one FTC behaviour for the next school session, lay out a taped test route, and ask each pair to create a fixed-count loop and a condition-based loop. Run both versions, compare their outcomes, and nominate one robot task for the team’s next iteration.
Maryland FIRST Robotics