O'Reilly logo

Getting Started with the Internet of Things by Cuno Pfister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Reading from Sensors

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.

Architecture of LightSwitch

Figure 3-1. Architecture of LightSwitch

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required