মাটি Earth, mission 3 of 4, after-action report

Back away from the wall

Read the library's types. The compiler won't argue for you.

064128192255setSpeed(−255) // "full reverse"uint8_t speed = −255;speed == 1 // a polite crawl−255 mod 256 = 1fix: signed speed,plus a direction pin
Explanatory diagram. Scroll sideways on a narrow screen.

The mission

E-Bhapa, a contest robot built in one night in 2024, is meant to drive up to a wall, back away and turn.

What happened

E-Bhapa, a contest robot built in one night in 2024, re-read line by line in 2026.

It drives into the wall and keeps pushing.

What I believed

The robot turns, backs away from walls and follows at a safe distance, as its README said.

  • The motor driver's dead. The motors are fine. They're doing exactly what they're told.
  • Front and rear wiring are swapped. Half true: the wiring was wrong. With it fixed, it still won't reverse.

What was true

It never turned and never reversed: both sides averaged to the same speed, and the motor library's speed is a uint8, so −255 became 1. Pinned against a wall 87 % of the time in simulation.

Try it yourself

E-Bhapa as flashed in 2024, and as fixedwatch both run

Loading the diagram. It needs JavaScript; the text around it says the same thing in words.

The fix

The motor library takes speed as an unsigned byte, so every negative speed wrapped to a small positive one. A signed speed plus a direction pin, and the robot reverses, turns and leaves the wall.

Pinned against a wall 87 % of a simulated run, as flashed in 2024.

Evidence: fh1m/E-Bhapa

Keep doing

Read the library's types. The compiler won't argue for you.

Do differently

Simulate the sketch as written, quirks included, before believing the demo.

Next report: Find the missing detections