Pages: [1]   Go Down
Author Topic: Tutorial/Button schematics  (Read 219 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

The "Circuit" and the "Schematic" on the tutorial page "Button" show the same wiring correct? Well, apart from using two different GND connection points. And what they show is how to use a pull-down resistor, correct?
The placement of the schematic made me think it would show the wiring for a pull-up resistor.

(I understand where a pull-up resistor would be placed).

Thanks,
PowderMonkey
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27357
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Most of us use the internal pullup resistor, with an external switch that connects the button to Gnd when pressed:
Code:
// pre setup
byte pinX = 2; // 2 to 19 generally
// or
const byte pinX = 2; // 2 to 19 generally

// in setup
pinMode (pinX, INPUT_PULLUP);

// in loop
if (digitalRead(pinX) == LOW){
// switch was pressed, do something
}
else{
// optional - do something else
}
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: