The first example in this chapter,
LightSwitch, not only writes to output ports, it also reads from input ports. The switch input is used to control the LED output, as shown in Figure 3-1. While the switch (actually a push button on the Netduino Plus board) is closed, the LED stays lit; otherwise, it is dark.
Figure 3-1. Architecture of LightSwitch
The program Example 3-1 reads the current switch state periodically and copies it to the LED. This is done frequently enough that a user does not detect a delay when she opens or closes the switch. Delays of 1/10th of a second or less are undetectable by humans; ...