Friday, January 11, 2013

Day 6: Push Buttons and Pullup Resistors

The SIK kit uses circuit 5 to teach people about push buttons and logic. Two push buttons are hooked up in circuits and used as inputs. An LED is then hooked up to an output. Depending on how whether you are pushing one button or two buttons, the LED will either be on or off. There are various little functions included in the included code that provide some good examples.

A Circuit with a Pullup Resistor



One of the things that really confused me, though, was the use of 10kohm resistor with the push button. The circuit looked like this:

5V -- 10,000ohm resistor -- input pin -- push button --GND

It turns out that this is pretty simple. When the push button is closed, you get the circuit:

input pin -- push button -- GND

Which sends no power to the input pin. This is a LOW signal.

When the push button is open you get the circuit

5V -- 10,000ohm resistor -- input pin

And so you are sending power to the input pin. This is a HIGH signal.

So now you can use these values of LOW and HIGH to program button behaviors. Here is a much more thorough explanation on the Sparkfun website. Awesome!

No comments:

Post a Comment

Post a Comment