Chapter 7. First Crossing

In this chapter we want to deal with the first thing for a traffic lights control system. Assume we have two crossing roads, and the most basic thing for our system will be to control the traffic lights for each direction. There is one thing the law asks us to consider for this system: Two crossing directions are never under any circumstance allowed to show green at the same time. We will keep this in mind while coming up with examples for our controller.

Controller Specifications

Let’s take a look at the specifications for the controller. We have two directions. The controller controls state transitions, probably by transitioning to the next state when some timer expires. The controller will change just one light at ...

Get ATDD by Example: A Practical Guide to Acceptance Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.