Summary

You have built a robot that drives on its own — and it has no program. Its whole «behaviour» is a few formulas, and you derived each one from what the robot has to do:

  • the manoeuvre — the steps of the CD4017 counter: forward → back 0.4 s → turn 0.4 s → forward;
  • wait for a bump — HOLD = NOR(NFWD, TRIP): the counter stands on step 0 until there is a reason;
  • the wheels — LDIR = NOT BACK, RDIR = NOR(BACK, TURN);
  • centimetres — 8 kHz ticks while the echo is on: 1 tick — 1 cm; stop at 99; the number into a register so the display does not flicker;
  • close — tens < 2 (CD4585), latched at the show step;
  • a reason for the manoeuvre — TRIP = HIT OR NEAR;
  • along the line — a wheel turns as long as its sensor does not see the line: LON = NOR(SL, NGO).
TRIP = HIT + NEARHOLD = NOR(NFWD, TRIP)LDIR = NOT BACKRDIR = NOR(BACK, TURN)NEAR: tens < 2, latched at SHOW
The whole robot: the pen path in the arena — turns 20 cm from the walls and the obstacle, and the formulas its «character» is made of.

What next

  • Change the threshold: B of the CD4585 = 3 — the robot turns at 30 cm, B = 1 — at 10.
  • Swap LDIR and RDIR on the chassis — the robot turns anticlockwise.
  • Draw your own track with the mouse — one closed line, smooth turns, no crossings.
  • Put a second robot in the same arena: the ultrasound sees another robot's body too.