Let's start with a pull up resistor. To do so, we will take the 10k ohm resistor and attach it as shown below.
We can just use the alligator clips to hook this up.
Now run the sketch from the previous section again. Try touching the BLUE alligator clip with your hand as you did before. Now it should never see any changes. It should be nicely held at 3.3V.
Now it should see the change and report it.
So we've fixed the floating input problem. The resistor "pulls" the input "up" to 3.3V and the pin reads HIGH (1). When we touch the BLACK clip, the pin sees 0V and reads LOW (0).
Additionally, the resistor prevents a short between power and ground. That's why it's important to touch the BLACK only to the BLUE. Even with this resistor in the circuit, it is still bad to touch BLACK to RED. DON'T DO IT!!
We can do the same thing in the other direction. That is, we can "pull down". Let's look at that next.
Page last edited February 23, 2017
Text editor powered by tinymce.