
www.picaxe.com/products/axe171
AXE171 PICAXE-14 Audio Kit © Revolution Education Ltd 2015 v1.1
May be copied for educational use.
12
4.2 Using the push switch
4.2.0 What are switches?
A ‘switch’ is a type of digital sensor, a sensor that can only be ‘on’ or ‘off’. Switches detect
movement.
There are a large number of different types of switches e.g.:
push switches that detect a momentary 'push'
micro-switches with long levers that detect small movements tilt-switches that detect jolting
reed-switches that detect a magnet being moved
4.2.1 What are switches used for?
Push switches are commonly used on device like keypads. Micro-switches are used in burglar alarms
to detect if the cover is removed from the alarm box. Reed switches are used to detect doors and
windows being opened and tilt switches are often used to detect movement in devices such as toys,
hair-dryers and tool-box alarms.
4.2.2 Using switches with a PICAXE microcontroller
A switch is often used with a resistor as shown in the diagram. The value of
the resistor is not that important, but a 10k resistor is often used. When the
switch is 'open' the 10k resistor connects the microcontroller input pin
down to 0V, which gives an ‘off’ (logic level 0) 0V signal to the
microcontroller input pin.
When the switch is activated, the input pin is connected to the positive
battery supply (V+). This provides an ‘on’ (logic level 1) signal to the
microcontroller.
10k