Arduino Tutorial 34: Simplest Way to Use a Pushbutton Switch

preview_player
Показать описание
You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:

In this lesson we show you a simply hack that will allow you to utilize a pushbutton switch on the arduino without using an external pull up resistor. Works like a charm and is simple to implement.

You can get the kit I am using for this series at the following link:

Follow these lessons on our WEB site:

#Arduino
Рекомендации по теме
Комментарии
Автор

Paul, your enthusiasm for electronics has made me a fan of you

apoorvaditya
Автор

Mr. Paul, your tutorials have really helped me to understand and learn Arduino. Your teaching style is like no other. Please keep posting Arduino tutorials!

SamFromSpaceOfficial
Автор

ButtPin... BWAHAHAHAHA!!! Got a good giggle out of that one! Hey, doing a whole video in one shot takes skill! Thank you, sir, for the great content. When’s my next fix coming? This was too little of a dose!

olegvelichko
Автор

Halfway Home... lesson 34 of 68! Loving learning new tech at my age, 70. Loving coding again, which I did a bunch before I retired. I still don't quite understand how a pull up resistor is introduced by setting an input pin to HIGH... but I'll go back and watch again. That confused me in the last lesson, too, no fault of yours.

MarvPerk
Автор

No secret word?? Have you gone MAD?? lol this video filled in a very important piece of the puzzle for a project I've been building. Many thanx, Paul! Would love to see a tutorial on shift registers with the kind of detail you put into videos. It's been an real treat to keep up with these.

mightythimble
Автор

I always prefer to have the value read "0" when the button is not pressed and "1" when it is pressed so I tried connecting the button to 5V and pin 2 and to write "LOW" to pin 1 to see if that would work as a pull down resistor. And it did :)

Thanks for this neat trick Paul!

elloco
Автор

thank you Paul for your time and effort you put into these videos, I really appreciate them. Please keep them coming. When you get the time could you do a video about interrupts and switch, case programming. you seem to be the only person on YouTube I can follow and understand, you teach in an excellent way.

daveharkin
Автор

Am I the only one who binge watches these? Day 3 and I'm already at 34...

TheSgrizli
Автор

BOSC O - I've watched them all - can't wait till you get into interrupts and multitasking. Thanks Mal

malcolmsnow
Автор

I just finished tutorial 34. I am writing the code for your projects before watching you do it. Thanks for doing these videos. I will utilize an Arduino to control an arcade shooting gallery that was made in 1969. When manufactured, the game was controlled by a custom 8 track tape player. I have been unable to get the tape player to function reliably so I will have an Arduino take over the game control. This shooting gallery was been rescued from the trash and completely restored. An Arduino will allow me to finish this restoration. Your tutorials enable this to happen.

mikeroerig
Автор

BOSCO, Hi Paul, this is the second time I've followed these tutorials and got to this point. First time stopped due to work commitments, this time determined to see it through until the end.
Very new to coding and electronics, but learning all the time. Thanks

alanfowler
Автор

You made me learn pull up and pull down resisters knowing full well, all along, that this existed!?!? Well played, sir.

thelocal
Автор

Thank you Mr. McWorther, I love this, now it's much easier for me to create pull up switches, also I decided to do a bit of neat formatting, so I added two if functions to say wether my button is on or off in the serial monitor. Here is the code.

int buttonPin=12;
int buttonVal;
int dt =100;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);

}

void loop() {
// put your main code here, to run repeatedly:

Serial.print("Your button is");
if(buttonVal==1){
Serial.println(" off");
}
if(buttonVal==0){
Serial.println(" on");
}
delay(dt);
}

aynursunagatullin
Автор

Hardware pull-up or pull-down resistors, this method and INPUT_PULLUP; we have options. I like the idea of using the Arduino internal pull-up because of it's simplicity but I wonder in what applications hard-wired PU resistors may be to our advantage.

michaelw
Автор

Watched this one prior to lesson 32. I think it helped to do this before you taught us how to use the joystick.

Half way done with the new lessons and I'm still here watching to the end and doing all the math. Your doing something right!

autocrosser
Автор

I've played with Arduino for ~1 year. This video is THE MOST IMPORTANT lesson that I've learned. YES, external pull-up resistors are OLD SCHOOL!!! (yet everyone continues to use them)

jeffbowyer
Автор

As far as I know instead of using 2 lines of code for making that pull-up resistor you can use 1 line of coffee that is pinMode(buttonPin, INPUT_PULLUP);

mayankshigaonker
Автор

that answers my question from one of the previous videos. Thanks

peterleitner
Автор

Thank you for this tip Sir Paul!


I have to agree with the earlier comments, that using the parameter INPUT_PULLUP
seems more natural and intuitive as it eliminates the need to write digitalWrite inside the void setup().

Hino_
Автор

Thanks, You used this with brief explanation in previous, without mentioning the internal pull up resistor. Much clearer now as to what is going on.

georgeshaiffer
welcome to shbcf.ru