O'Reilly logo

Getting Started with Arduino by Massimo Banzi

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 5. Advanced Input and Output

What you have just learned in Chapter 4 are the most elementary operations we can do in Arduino: controlling digital output and reading digital input. If Arduino were some sort of human language, those would be two letters of its alphabet. Considering that there are just five letters in this alphabet, you can see how much more work we have to do before we can write Arduino poetry.

Trying Out Other On/Off Sensors

Now that you’ve learned how to use a pushbutton, you should know that there are many other very basic sensors that work according to the same principle:

Switches

Just like a pushbutton, but doesn’t automatically change state when released

Thermostats

A switch that opens when the temperature reaches a set value

Magnetic switches (also known as “reed relays”)

Has two contacts that come together when they are near a magnet; used by burglar alarms to detect when a window is opened

Carpet switches

Small mats that you can place under a carpet or a doormat to detect the presence of a human being (or heavy cat)

Tilt switches

A simple electronic component that contains two contacts and a little metal ball (or a drop of mercury, but I don’t recommend using those) An example of a tilt switch is called a tilt sensor. Figure 5-1 shows the inside of a typical model. When the sensor is in its upright position, the ball bridges the two contacts, and this works just as if you had pressed a pushbutton. When you tilt this sensor, the ball moves, and the contact is ...

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