Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 2.43 KB

README.md

File metadata and controls

50 lines (40 loc) · 2.43 KB

Sparkfun Button Pad 2x2

This is sample code to drive the Sparkfun Button Pad 2x2 from an Arduino.

It lights up the LEDs different colors each time you press it.

Hardware

You will need:

Theory

To drive the LEDs we are going to use PWM/AnalogWrite to drive the common pin on each LED, then cycle through each color one at a time. You need to put the resistors where it will not be supplying current for more than one LED at a time, so we put it on the common pins of each LED.

For reading the buttons, I used the Keypad library. It handles all the debouncing and pin IO for you, which is handy.

Wiring

PCB Label Arduino Pin
SWITCH A0
SWT-GND1 A1
SWT-GND2 A2
SWT-GND3 A3
SWT-GND4 A4
LED-GND1 3
LED-GND2 5
LED-GND3 6
LED-GND4 9
RED 4
GREEN 7
BLUE 8