Swipe-card reader sends to control program

If we invert the relationship, here's what happens:

  1. A big delay occurs until the next person swipes their card.
  2. Swipe sends message "Swipe card ID # xxxx was swiped."
  3. Control replies with "OK, change LED to GREEN."
  4. A 20-second delay occurs, while the door is opened.
  5. Control sends a pulse "Change LED to RED."

In this case, there was one pulse, and just one message.

An important design note is that the LED color change was accomplished with a reply in one case (to change it to green), and a pulse in another case (to change it to red). This may be a key point for your design, depending on how much data you need to carry in the pulse. In our example, simply carrying the color of the LED is well within the capabilities of the pulse.

Let's see what happens when we add a keypad to the system. The purpose of the keypad is for Control to issue a challenge to the person trying to open the door; they must respond with some kind of password.