Mission 6  ·  Hints

Follow the Line

Open one hint at a time. Try it before you open the next.

Hint 1 — Think about it
The sensor reads a brightness number: white floor is high, black tape is low. The edge of the line is in between — the average. If the reading is above that, you are drifting onto white: steer one way. Below it: steer the other way. The further away, the harder you steer. The turret stays centred.
Hint 2 — Which blocks to use
color sensor F reflected light %The brightness number: your steering input.
repeat until < color sensor sees green >Keeps following until the finish.
motor ( D ) go to position ( number )Steering = (reading − target) × K.
start moving forward (slow speed)Slow is more accurate. Start at 25 %.
Hint 3 — Plan in plain words
  1. Measure the white floor and the black tape reflection; target = the average.
  2. Start moving slowly.
  3. Loop until green: steering = (reading − target) × K.
  4. Stop and celebrate.

Watch out: If the car steers away from the line, flip the sign of K. If it wobbles, make K smaller or the speed lower. The edge of the tape can flicker as “green” — ask for green twice in a row. Rear-steering cars need gentle curves.

Playbook: Follow the line · Green means go

← Challenge

Printable version: mission-6-hints.pdf