Go Down

Topic: Tutorial/Button schematics (Read 349 times) previous topic - next topic



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).



Most of us use the internal pullup resistor, with an external switch that connects the button to Gnd when pressed:
Code: [Select]

// 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
// optional - do something else
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131