Switches - davidmckechnie/IoTChallenge2015 GitHub Wiki
LED Switches
There are two switches: one switch is momentary type (so it only connects while it is pressed) and the other is latching (so it clicks into on and off states).
You can wire the pin marked +
to any digital pin (with a low value resistor in series, approx 47 ohms) and the pin marked -
to ground, and turn the LED on and off by writing a 1 or 0 to this pin.
The other two pins are for the switch. You can connect the switch between any digital pin and ground, and configure the pin as INPUT_PULLUP
. Then it will read:
- Digital HIGH / 1 when the switch is open using the internal pullup, and
- Digital LOW / 0 when the switch is closed and the switch connects the pin to ground.