Protoshield's pushbutton usage

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Protoshield's pushbutton usage

Postby EDevil » Wed Feb 18, 2009 5:37 pm

Hello.

I'm new at this arduino business so please bear with me. I built the protoshield but for the life of me can't seem to figure out how to use the S1 button included in the protoshield.

In this image Image the S1 button is connected to an digital input/output of the arduino. According to the schematics Image S1 is connected to the ground. So when the button is pressed I read GND, when it's not the value is seems to vary.

I'm trying to use the button to light up a led but the normal circuits I find in the net are not like this. Can anybody shed some light on this?

Thanks.
EDevil
 
Posts: 3
Joined: Wed Feb 18, 2009 5:28 pm

Re: Protoshield's pushbutton usage

Postby adafruit » Wed Feb 18, 2009 7:32 pm

you need a pullup resistor
http://www.ladyada.net/learn/arduino/
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Protoshield's pushbutton usage

Postby EDevil » Thu Feb 19, 2009 4:40 pm

I've read the tutorial, but none of the examples use the builtin button in the protoshield. I understand those circuits with 5V and resistors but the image show a direct wire from the button to an arduino input.

I don't undetstand what we're supposed to read from that, GND or undefined if the button in not pressed...
EDevil
 
Posts: 3
Joined: Wed Feb 18, 2009 5:28 pm

Re: Protoshield's pushbutton usage

Postby unwiredben » Thu Feb 19, 2009 5:35 pm

You need to take a 10K resistor and connect it from the digital input pin to +5V. You also connect that input pin to the button. This causes the input voltage to be pulled to 5V when the button isn't pressed, but the resistance is high enough so the ground can assert itself nicely when the button is pressed.

You can also use the internal pull up resistors built into the AVR chip -- see the explanation at http://www.arduino.cc/en/Tutorial/DigitalPins. This is easier and doesn't require extra components.
User avatar
unwiredben
 
Posts: 75
Joined: Fri Dec 19, 2008 1:02 pm
Location: Brooklyn, NY

Re: Protoshield's pushbutton usage

Postby EDevil » Fri Feb 20, 2009 4:47 am

Thanks a lot!

The idea of sticking two wires on the same arduino input didn't seem "right" but now it makes sense.

Thanks for the software resistors tip as well.
EDevil
 
Posts: 3
Joined: Wed Feb 18, 2009 5:28 pm


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 0 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]