Switches

In the first series of packets, the code in most examples was used as
a “switch” to turn LEDs on and off.

What if you want manual control, so that you can switch the Arduino’s
functioning ON or OFF? One way to do this is the Serial Console,
introduced in the SerialConsole packet.

You can also use any one of a variety of mechanical switches to exert
human control over the Arduino’s behaviour. This packet illustrates some
common types of mechanical switches.

Some Switch Nomenclature

There are hundreds (at least) types of switches.

Switches are also characterized by the amount of current and voltage they can
switch. Typically, big switches are needed to turn on or off a lot of current,
and tiny switches can be used to turn on and off a small amount of current.
The pins on an Arduino typically convey <40mA of current, so tiny switches work
well with Arduino hardware.

Types of Switches

Packet slide-switches
introduces slide switches, which you can use to activate or de-activate
some statement or block of your code by pushing the handle from one side
to the other.
Packet pushbuttons
introduces pushbutton switches.
Packet latches
uses the same hardware and circuitry as packet pushbuttons,
but shows how to use the pushbutton in a “latching” mode, instead of a
“press-and-hold” mode. This simple change will introduce the phenomenon of
switch bouncing, and show you how to overcome it.

All of the packets in this section use simple LEDs.

Wikipedia has a great summary of the nomenclature and various forms of
physical switches.