Arduino Tutorial 27: Understanding Pushbuttons and Pull Up and Pull Down Resistors

  Рет қаралды 260,562

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 606
@coultercrooks7680
@coultercrooks7680 3 жыл бұрын
Having binged these videos today, I would be dead if I drank the amount of coffee I've been told to drink
@davidmarquez2821
@davidmarquez2821 3 жыл бұрын
you would die smarter, lol
@jamesc8453
@jamesc8453 2 жыл бұрын
LOL this is so true but I love Paul's bedside manner. Hopefully I won't be dinged as I am an espresso/latte drinker... sorry gotta have it HOT.
@Scoobydcs
@Scoobydcs Жыл бұрын
Drinking game. Every time paul tells us to drink coffee. Take a shot. Actually DONT do that until you've put me in your will
@robjerome6092
@robjerome6092 2 жыл бұрын
I am 71 years old and my grandson is 12. This old dog along with my grandson is trying to keep mentally stimulated. Because of Covid I have my 12yr old Grandson living with me as his mother is a nurse and being exposed to the virus on a daily bases. We are really enjoying the tutorials.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Wow, that is wonderful. What great memories you are building with your grandson. My grandfather taught me so many things, and I have many wonderful memories of him. Well done!
@marvinoctopusody4613
@marvinoctopusody4613 11 ай бұрын
That's really great.
@michellehe8239
@michellehe8239 8 ай бұрын
oh hey,this is great.Rob. I want to do this to keep myself aleays young and energnic
@daniellehwing4667
@daniellehwing4667 7 ай бұрын
You are not just talking to yourself, professor... ...you are talking to 241.000 of us!! Cheers!!
@devlinaganguly8352
@devlinaganguly8352 4 жыл бұрын
Sir,I have learnt coding on arduino just because of your tutorials,and what I have observed is that in the other tutorials,they simply give the code without explanation,but because of your explanation and your funny actions,I have completely learnt how to code.
@rogermaximiliengosselin4635
@rogermaximiliengosselin4635 4 жыл бұрын
It'is in fact absolutely important to have a written strategy.
@Ichennai
@Ichennai 4 жыл бұрын
yeah
@SGOI_AUS
@SGOI_AUS 4 жыл бұрын
totally agree
@chokinghazard2942
@chokinghazard2942 2 жыл бұрын
I take notes from these videos, I actually learn a lot more than even coding boot camps.
@jobeyene3342
@jobeyene3342 4 жыл бұрын
For the first time in my life followed a lesson for the entire day from 7 am to 7 pm, none stop. I usually cannot stay focused for 5 min max due to ADD I have, but your way of teaching makes me not to think anything else except listening every single word coming out from your mouth and remained concentrated on the computer screen.
@stephenmichael2687
@stephenmichael2687 4 жыл бұрын
I also have ADHD and dont take medication for it. He is an amazing teacher, there hasn't been one episode yet that lost my attention.
@Hugo-ep4po
@Hugo-ep4po 4 жыл бұрын
Hello there. I hope you're doing well. People with ADD or ADHD have a characteristic where if they are interested in a topic they will "Overfocus". That might be the case for you. Although this is good, make sure to take breaks so you stay healthy. If I don't watch out, I generally forget to eat.
@dhruvchaturvedi7030
@dhruvchaturvedi7030 3 жыл бұрын
Haha idk if I too have ADHD or smth because guess what! It’s the same for me. I find studies and concepts boring but somehow I’m just too hooked to these videos. Even the theory gets me hyped. It’s come to the point i wake up at 6am and just follow the lessons the whole day on weekends. Please don’t ever stop making videos and stop teaching. Lots of love from India ❤️
@sonalighosh4243
@sonalighosh4243 4 жыл бұрын
sir , i am a student in high school and i have been learning cording from you from last year and to my surprise i have left the others who are learning for a couple of years back just because of you. thank you "SIR"
@paulmcwhorter
@paulmcwhorter 4 жыл бұрын
Keep it up
@jsha6604
@jsha6604 3 жыл бұрын
I have a doubt that can we display two different output on lcd(16*2) with the help of arduino and two push buttons can you please give me the overview how to do this? it would be really helpful if you reply. Thank you
@harveyellis6758
@harveyellis6758 3 жыл бұрын
@@jsha6604 Looks like someone has a homework project that they want someone else to do for them ;-)
@chrisnizer
@chrisnizer 3 ай бұрын
Still watching in 2024 and still havin' a good time with the whole creative process. Thank you for sharing your knowledge and experience my friend, Semper Fidelis!
@CR046
@CR046 5 жыл бұрын
Paul, It's always a pleasure to see you explaining technology-stuff on youtube! Thank you for this! Greetings from belgium (vlaanderen).
@ricardogomezlucea5357
@ricardogomezlucea5357 4 жыл бұрын
i'm having so much fun with yours teaching classes....
@Craftymcstabber
@Craftymcstabber 4 жыл бұрын
I was yelling at you for using a period instead of a comma :D
@oleksandrkovalov1543
@oleksandrkovalov1543 Жыл бұрын
Mr McWhorter, I have a question-could you please explain how you decide what resistor to choose ? Why push button requires 10k and photo resistor only 5k? What needs to be considered here ? I kinda of have a guess why we have 330 for the led (I did calculation and I think even 150 is fine, I divided 3v by 20ma and that gave me 150 om and I used 20ma as max current that the led can handle ) thank you again
@inuser3543
@inuser3543 Жыл бұрын
I very rarely drink coffee at all, but for the last few days, I guess my roommate is starting to worry about 27th cup of black ice coffee with no sugar
@user-vn7ce5ig1z
@user-vn7ce5ig1z 5 жыл бұрын
It would have been good to explain why and how using pull-up and pull-down resistors work (i.e., why the electrons go where they do, e.g., why don't the electrons go down the other wire when the switch is closed) and the benefits of using them (e.g., preventing floating inputs).
@alinbogdangeorgepatuleanu6536
@alinbogdangeorgepatuleanu6536 5 жыл бұрын
You exaggerate!!!!!
@Kurtacuss
@Kurtacuss 4 жыл бұрын
It's great to just follow along at mine own pace . It make learning a whole lot a fun Thanks for doing these tutorials again for us.
@paulmcwhorter
@paulmcwhorter 4 жыл бұрын
Glad you like them!
@MagoTonyMiami
@MagoTonyMiami 3 жыл бұрын
While holding my breath I forgot to add something. This is an interesting approach to PULL UP/DOWN resistors: super easy and intuitive but, for those who are addicted to details (i.e. masochists) like me, could we have a more detailed explanation on the value of the resistors compared to the inner impedance of the Arduino's reading pin?
@llewsub
@llewsub 3 ай бұрын
I'm confused by the way he explains the pull up resistor. He specifically references V=IR, then explains that there is no current so V=5V due to there being no voltage drop... But if there is no current then I=0A -> V = 0 * R -> V = 0... If there's no current then how could there be a voltage?
@MagoTonyMiami
@MagoTonyMiami 3 жыл бұрын
i've recently found this channel and i'd like to thank you for your great professionalism and passion: you are definetly the teacher i've always wanted to have.
@therandombros300
@therandombros300 4 жыл бұрын
Thank you very much sir!!! I do have one question, though. How did you know to use a 10K resistor? And how do you know what resistors to use on general?
@TheRaptor1967
@TheRaptor1967 4 жыл бұрын
At this stage, values are not too important. 10K resists enough so you have something to measure. 20K does the same job (yeah, I double checked before saying that to make sure). My kit has 220 Ohm resistors instead of 330 Ohm resistors. they work exactly the same for this use (maybe the LED is a fraction brighter?). LED's want 3V, not 5V. 5V will eventually burn them out. Putting a resistor of about that value (220-330) brings down the voltage to somewhere around 3V or lower. No expert so that's a rough explanation is rough. but the idea is correct.
@nishanthraj7443
@nishanthraj7443 3 жыл бұрын
@@TheRaptor1967 the idea of putting a resistor here..is to prevent the switch from impedance State.
@faizalsande2253
@faizalsande2253 3 жыл бұрын
Idk why but I cross checked all my connections and also checked my code but it’s showing only “0” in the serial monitor even after pressing the button . Could anyone help me out?
@BHFJohnny
@BHFJohnny 3 жыл бұрын
Exactly my question. Why not 100k or 300k? Less current, less wattage, more battery life
@matheokoning4456
@matheokoning4456 3 жыл бұрын
Why not, no risistor? I do not understand why you have to use a resistor to read the push button whether it is high or low. I just tested this without the resistor and it works just fine. Do I miss something?
@Eduard-wg4dr
@Eduard-wg4dr 5 ай бұрын
I am 12 years old and your videos have sincerely amazed me so far. Arduino was already my favourite hobby but you helped me improve so much. Thanks !
@rafaelaprende
@rafaelaprende 2 жыл бұрын
Thank you. :-) Just ONE question. Why 10,000 ohms? Which data and formulae did you use to calculate it? Because it seems nobody knows why 10,000 Ohms.
@jacklawson9748
@jacklawson9748 4 жыл бұрын
I'm getting an Arduino for Christmas (4 days away) and have been doing these lessons for the last few weeks. I like how you present things in bite-sized pieces and particularly how you show yourself thinking and figuring out stuff yourself and making mistakes and showing to solve them. I think too often people think engineers, or people in any profession for that matter, don't have to actually work, think and struggle at times. Your lessons are great!
@sidrabalhawan1706
@sidrabalhawan1706 2 ай бұрын
I always get a 0 out of the buttonRead. By default and when I press on it. Can anyone help solving this problem?
@Xer_Mrcy
@Xer_Mrcy Жыл бұрын
I'm having an issue where I can completely take out the button circuit, however it still somehow reads 0 and 1 randomly turning my LED on and off, and even set up correctly the button does make it turn on but it still randomly turns on and off, I don't know what to do
@71DJL
@71DJL 3 жыл бұрын
Great, easy to follow tutorial as usual - thanks Paul A question if you don't mind. What is the reasoning behind choosing specifically a 10K Ω resistor for this project ? How do you decide what value resistor to use ?
@ehas5527
@ehas5527 2 жыл бұрын
I have the same question too. As i saw in a data sheet the arduino uno output current is 40mA. So the voltage drop across this 10kΩ resistor would be 400V (V=IR=0.04A*10,000Ω). That means theoretically no current will reach the arduino reading pins when using the pull up method right? But when practically done, I got the reading as 1. I'm a bit confused. Appreciate if anyone can explain this. Thank you:) Also, your tutorials are great sir!!
@charlescho7250
@charlescho7250 Жыл бұрын
Aha! Now I understand what are pull up pull down resisters are. Thank you, Paul!👍
@samueltheprogrammer6145
@samueltheprogrammer6145 Жыл бұрын
That is really good, because pullup and pullDown resistors are very important in electronics. Samuel
@SedraBalhawan
@SedraBalhawan 2 ай бұрын
The button is always by default 0 and it is not switching to 1 when it gets pressed. Does anyone know why?
@abdullahmuslim280
@abdullahmuslim280 4 жыл бұрын
I just can not fined any bad thing to say, I love the Totorials!
@patfacunla1687
@patfacunla1687 4 жыл бұрын
Thank You Paul !!! Been here since episode #1. Loving this series, Stay Safe Paul. =D
@kanhaiyaupreti6702
@kanhaiyaupreti6702 5 жыл бұрын
Please Continue uploading,your tutorials are amazing. ❤️♥️♥️💚💙💜 Love from India.
@marcelomarquesrangel
@marcelomarquesrangel 2 жыл бұрын
I really was looking forward to tinkering with pushbuttons and the explanation about pull-up and pull-down resistors is something I'll definitely look into further in this series. Although I fell like I can't wait to start building a MIDI footcontroller for my guitar pedals, I've been enjoying the series so much that I think I'll benefit from more learning. So thanks for your amazing tutorials, Paul! I got carried away and decided to push myself a little further this time. I hook up three pushbuttons to control different LEDs and wrote this code. I used all the input from this tutorial, but any feedback and considerations about my code are highly appreciated. =) BTW, I'm using a Lolin(WeMos) D1 R1 Wifi, so the pins come as "D#" in the code. int redLEDPin=D2; int greenLEDPin=D3; int blueLEDPin=D4; int redButtonPin=D5; int greenButtonPin=D6; int blueButtonPin=D7; int redButtonRead; int greenButtonRead; int blueButtonRead; int DT=20; String redmsg= "RED button value: "; String greenmsg= " GREEN button value: "; String bluemsg= " BLUE button value: "; void setup(){ pinMode(redLEDPin,OUTPUT); pinMode(greenLEDPin,OUTPUT); pinMode(blueLEDPin,OUTPUT); pinMode(redButtonPin,INPUT); pinMode(greenButtonPin,INPUT); pinMode(blueButtonPin,INPUT); Serial.begin(9600); } void loop() { redButtonRead=digitalRead(redButtonPin); greenButtonRead=digitalRead(greenButtonPin); blueButtonRead=digitalRead(blueButtonPin); Serial.print(redmsg); Serial.print(redButtonRead); Serial.print(greenmsg); Serial.print(greenButtonRead); Serial.print(bluemsg); Serial.println(blueButtonRead); delay(DT); if(redButtonRead==0){ digitalWrite(redLEDPin,LOW); } if(redButtonRead==1){ digitalWrite(redLEDPin,HIGH); } if(greenButtonRead==0){ digitalWrite(greenLEDPin,LOW); } if(greenButtonRead==1){ digitalWrite(greenLEDPin,HIGH); } if(blueButtonRead==0){ digitalWrite(blueLEDPin,LOW); } if(blueButtonRead==1){ digitalWrite(blueLEDPin,HIGH); } }
@chrisb7250
@chrisb7250 Жыл бұрын
I like how you put the strings in there. Very organized. Props.
@Gustavwessels
@Gustavwessels 6 ай бұрын
Thanks for the great series? When would you use a pull up vs pull down resistor?
@prasannajanarthanam5431
@prasannajanarthanam5431 5 жыл бұрын
Why we use 10K for pull up and pull down resistor ? Shall we use some other value of resistor for it ?
@andymouse
@andymouse 5 жыл бұрын
you can use a bit bigger or a bit smaller its just that 10K is a "goto" value
@michaelcostello6991
@michaelcostello6991 4 жыл бұрын
Maybe it draws too much current from arduion. I=V/R
@cub1c698
@cub1c698 4 жыл бұрын
Can't you connect the push button across the trench if there is no space for you to connect things in the same column.
@danbishop4035
@danbishop4035 4 жыл бұрын
I've been wrapped up in some other tasks but have finally found some time to continue on with the New and improved Arduino tutorials I do appreciate all that you do in these videos. Thanks again for your valuable time.
@pippaknuckle
@pippaknuckle 3 жыл бұрын
Pull down resistors pull towards the ground Pull up resistors pull toward the sun Trying to make a rule of thumb :) What do you think?
@meluobote7664
@meluobote7664 3 жыл бұрын
for pull up resistor, I think the resistor is also should be big to make true that the voltage of measure point is 5V, if so, because the resistor is so big ,then it can't dirve other things good, such as buzzer, motor; so it just have one function to make sure a point''s voltage is HIGH, am I right?
@PerfectBiscuits
@PerfectBiscuits 2 жыл бұрын
Great lesson as always, but you didn’t really explain why you need a pull-up/pull-down resistor. You need one to prevent a “floating pin”. Without a pull-up resistor, you won’t get a full 5V OR without a pull-down resistor you won’t get an absolute 0V. Honestly don’t know the physics behind this and would love to hear one of your most excellent explanations!
@ricardogomezlucea5357
@ricardogomezlucea5357 4 жыл бұрын
I wish i had a PROFESOR like yourself when i was young at high school ....THX!!!
@prasannajanarthanam5431
@prasannajanarthanam5431 5 жыл бұрын
You're just amazing just now finished this video.. You're a great teacher please keep doing this good work forever. Wish to see more videos.. In short from this second am your fan sir !! 😊
@MrJonjoe1977
@MrJonjoe1977 2 жыл бұрын
I tried learning pull up and pull down resistors before from a book and couldn't make sense of it. This explanation was so easy to follow. I now feel I fully understand it. Thanks!
@manuelpacheco5446
@manuelpacheco5446 3 жыл бұрын
Paul, I didn't realize that a pull up and pull down resistor acted that way with a push button. Nice!! Manny from Puerto Rico
@ajyu7289
@ajyu7289 4 жыл бұрын
12:48 conversely, you could install the pushbutton across the middle trench and give each lead a nice long column of 4 holes
@lensman192
@lensman192 2 жыл бұрын
That is what I did too. Spread out the circuit some. I used the bottom row for the ground bus and the top row for the 5 Volts with two vertical circuits on the board.
@Hino_55
@Hino_55 4 жыл бұрын
Pull-Up configuration is like a Normally-Closed switch AND Pull-Down configuration is like a Normally-Open switch Sir, i think you interchanged the conditions in the if statement, my understanding is if it displays 1, the LED should be ON and if it is 0, the LED should be OFF. Thereby creating a Normally-Closed switch. Nonetheless, Thank you for this amazing lesson Sir Paul!
@midnightrizer
@midnightrizer 3 жыл бұрын
I totally Agree. but pull up has to go high and pull down goes to ground.
@aklmini-makers4304
@aklmini-makers4304 4 жыл бұрын
Great lesson! Important definitions for Pull-Up or Pull-Down. Cheers from New Zealand. The circuit [LED hookup] took me a few minutes to debug. Looking forward to #28
@andyhoskins1054
@andyhoskins1054 3 жыл бұрын
Hi Paul. Great video. Please tell me what I’m doing wrong. Followed the code exactly and built the circuit as per your design, however serial print returns the value 12 not 1 and the led comes on when I press the button yet serial print does not change to 0 it still returns 12. Thanks Andy
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
First, you have to understand that if you do exactly what I did, you will get exactly the result I got. So, step one is to mentally accept you have made a mistake somewhere. Either you have a code error, or you have hooked things up wrong, or you have a loose connection. Very, very, very rarely is it ever faulty hardware. Go through it methodically and find your error.
@ExonerativeKoala
@ExonerativeKoala 4 жыл бұрын
Thank you so much for these lessons, Mr. McWhorter! There is so much to learn before I can take on those robotics and AI lessons, but I watch your videos everyday and do the homework. You're doing me and the world a service. P.S. I love learning the fundamentals like the physics of what's happening. It's important for us to know.
@emryscass7327
@emryscass7327 4 жыл бұрын
No kind of instructional information came with the Elegoo Starter Kit. How are you determining what does or does not need a resistor? How did you know the push button required a 10K resistor and the LED only needed 220?
@midnightrizer
@midnightrizer 3 жыл бұрын
The Elegoo Starter kit has instruction on the site and also the Disc in the kit.
@olegvelichko1659
@olegvelichko1659 5 жыл бұрын
Yes! Another Arduino video in the series! Oh, speaking of ice coffee: throw a half a glass of ice, shot of espresso (or a similarly strong coffee or a tablespoon of instant), pinch of salt into a blender (add sugar to taste). Blend to foam. Enjoy a fantastic frothy beverage. :) Great content Paul! Keep em coming!
@jbeard3390
@jbeard3390 4 жыл бұрын
I still don't understand the purpose of pull up pull down resistors or what they do. Can someone explain or point me to another video Edit: what's the point of the resistors? In the diagram you read 5 or 0, so whats the need for ther resistors? Also still confused on orginal question
@aureliuse3469
@aureliuse3469 3 жыл бұрын
same i also confuse why we need the resistor? what it actually do
@daleredfern4472
@daleredfern4472 4 жыл бұрын
Hey Paul, just letting you know that people (okay, I speak for one person ;) ) watch your videos and learn something each episode. For some reason it took a moment to grasp that pull up resistors read 1 while OPEN and 0 while CLOSED. I suppose that pull down resistors are more intuitive for me. No harm if it's 2 sides of the same coin!
@lioneljsimon
@lioneljsimon 5 жыл бұрын
Hi Paul, stumbled across your channel a few weeks ago, and I have to thank you for the clear and insightful lessons, I'm actually struggling with a pushbutton so im super excited about the new vid. Cheers from Cape Town, South Africa!
@Time4yes
@Time4yes 4 жыл бұрын
I am also from south African (GP).... I love this channel, helps me a lot with my varsity projects.
@1stcomment700
@1stcomment700 5 жыл бұрын
Haha, Ive always prepared myself for your lessons with iced coffee
@kushagrachauhan7034
@kushagrachauhan7034 3 жыл бұрын
Thankyou Sir from the bottom of my heart.
@datageeksms
@datageeksms 3 жыл бұрын
Sir i get 0 1 0001 0 1 01 01 01 output automatically. Without connecting any wires. help me to solve this issue.
@evanbudd649
@evanbudd649 2 жыл бұрын
Maybe missing a pull up or pull down resistor. Replaying Paul's previous lesson may help.
@robertmurphree7210
@robertmurphree7210 4 жыл бұрын
Made boolean flag var, to implement toggle feature, it worked. after this i added debounce code from borrowed code. purchased 1) Arduino nano 2) ~4660 -5220 contact breadboard later will get pre-bent leads. Great class, thank you Paul.
@jimfisher5099
@jimfisher5099 3 жыл бұрын
It took nearly all day to do the homework but it worked!! Love the videos and I am doing them with you. Thanks for some of the best content on KZbin!!
@ilyashick3178
@ilyashick3178 4 жыл бұрын
Paul, I guess 0 could be ground, and in setup LED can be LOW.It is more logic: 0 no button push - Off and 1 button pushed On (+ 5V).
@spy8464BB
@spy8464BB 5 күн бұрын
A quick question, but first a thank you for your efforts in creating this series. It is now Sept 2024. If Im not mistaken there have been some changes with the Mega 2560 R3 boards. I have just completed this current leason and have a question. From what I understand the newer boards have pull up resistnce built into the chip for most of the pins. If I am understanding this correctly I dont need the 10k resistor in line with the switch. The "Digital Input" exercise that came with my starter kit doesn't require a pull up resistor to be inserted into the breadboard. Please correct me if I am misunderstanding things here. Its all about learning. Thanks again.
@jasonford1
@jasonford1 4 жыл бұрын
This one took me a long time to debug. I bridged my button over A and the - column instead of the gap between E and F. Silly me forgot the - column is all connected. The button was rendered useless since the circuit was always closed even if the button wasn't pressed. Mistakes are the best lessons outside of listening to you Paul.
@Sam-rz5hw
@Sam-rz5hw 2 жыл бұрын
BOOOOOM !!!!
@steveschaefer4648
@steveschaefer4648 3 жыл бұрын
Thank you for these lessons. I have been teaching hs physics for 29 years and like the way you pull together all elements of stem into your lessons. I plan to start using arduinos with my physics classes. You have really inspired me.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Great to hear!
@chirukapil
@chirukapil 4 жыл бұрын
The tutorials are really interesting and learning new concepts in each in every classes. Never seen a tutorial which goes into more details. Teaching method by Paul McWhorter is really great. Keep up the good work.
@mikemanny1533
@mikemanny1533 4 жыл бұрын
Hi Paul...Greetings from Great Britain. I've been a professional sparky for twenty-odd years, and had never heard of this type of switching before! Congrats on another barn-storming description-fest that explained everything perfectly. Fair play to you, mate.....YOU DE MAN! There's no other Yankee git who can explain this subject like yourself...lol. Seriously though, thanks a lot, mate...and keep 'em coming! Regards from the Grumpy Limey.
@mihkuno
@mihkuno 4 жыл бұрын
Im a beginner at this but.. How did you know to use a 10K resistor? And how do you know what resistors to use on general?
@vinodkumar-mp8fm
@vinodkumar-mp8fm 6 ай бұрын
Thank you sir i am 13 years old and have interest in engineering u helped me to bring my dreams to life I wish every student gets a teacher like u
@paulmcwhorter
@paulmcwhorter 6 ай бұрын
Excellent! Keep it up and you will go far. You might even invent something that changes the world.
@r2jit2
@r2jit2 5 жыл бұрын
Paul, I love you. I love your lessons. I bought two kits through your link. Just one thing... is there any way you could use something besides a sharpie to write things? Aside from bleeding through to the sheets underneath, hearing it write is like the polar opposite of ASMR. Thanks and much love!
@adrianmadigan7298
@adrianmadigan7298 5 жыл бұрын
This was my sketch int redPin=8; int buttonPin=12; int buttonRead; int del=250; int redRead; String msg="buttonRead= "; String msg2="redPin= "; void setup() { Serial.begin(9600); pinMode(redPin,OUTPUT); pinMode(buttonPin,INPUT); } void loop() { buttonRead=digitalRead(buttonPin); redRead=digitalRead(redPin); Serial.print(msg); Serial.println(buttonRead); delay(del); Serial.print(msg2); Serial.println(redRead); if (buttonRead==0 && redRead==0){ digitalWrite(redPin,HIGH); } if (buttonRead==0 && redRead==1){ digitalWrite(redPin,LOW); }
@bossysmaxx3327
@bossysmaxx3327 11 ай бұрын
My Logic: int pin1 = 12; int pin2 = 13; int led = 9; int lightVal = 100; void setup() { // put your setup code here, to run once: pinMode(pin1, INPUT); pinMode(pin2, INPUT); pinMode(led, OUTPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: float volt1 = digitalRead(pin1); float volt2 = digitalRead(pin2); analogWrite(led, lightVal); if (volt1 == 0) { lightVal += 20; if (lightVal >= 255) { lightVal = 255; } } if (volt2 == 0) { lightVal -= 20; if (lightVal
@zainab6740
@zainab6740 3 жыл бұрын
Sir, I learnt a lot through your classes. It is great that you teach through the basics. It helps clear up misconceptions and makes complicated projects feel easier
@shubhamsavaj1992
@shubhamsavaj1992 Ай бұрын
Paul Sir when you started this series i completed my 10th then i not decided what to do in my life i was dumb. Then i go in this science field i did +2 and got very good result. now i am in college 3rd year is on going i took Cse(iot) because i getting full funded goverment scholarship in private college. But problem is Iot course is outdated in my college. So can you help me. Can you give roadmap for IoT. I'm Very very thankful you i motivate when i see you. You creating this wonderful tutorial in your 80s. I will be happy even if you just read it😅
@andywylie287
@andywylie287 3 жыл бұрын
Boom! These tutorials are great!
@ericmartos8400
@ericmartos8400 4 жыл бұрын
if... else int rLED=8; int bPin=12; int dT=500; int readPin; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(readPin,INPUT); pinMode(rLED,OUTPUT); } void loop() { // put your main code here, to run repeatedly: readPin=digitalRead(bPin); Serial.println(readPin); delay(dT); if (readPin==1){ digitalWrite(rLED,LOW); } else { digitalWrite(rLED,HIGH); } }
@mayankshigaonker7725
@mayankshigaonker7725 5 жыл бұрын
Hello Sir I'm Mayank and this is my assignment on toggling the led: int ledPin = 3; int btnPin = 2; int btnNew; int btnOld; int led; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(btnPin, INPUT_PULLUP); } void loop() { btnNew = digitalRead(btnPin); if ((btnNew == 0) && (btnOld == 1)) { led = !led; digitalWrite(ledPin, led); } btnOld = btnNew; } Thank you Sir for another awesome lesson.
@lenoncastillo2036
@lenoncastillo2036 3 жыл бұрын
Great teacher!!! I'm learning a lot and good from your tutorials, thank you!!!!!
@GoodMods
@GoodMods 4 жыл бұрын
What happens if you don't use a 10k resistor?
@GoodMods
@GoodMods 3 жыл бұрын
I found something usefull ! use INPUT_PULLUP ! where PULLUP means you use the 10k resistor of the arduino board :)
@chrisrigas1
@chrisrigas1 4 жыл бұрын
thanks very much...for your time..Chris from Athens ..i hope one day ..you are going to learn rx and tx ...and bluetooth how to use with apinventor2..!!!!!!!!!!!!!!!!!!!!!!!!!!!
@marigeo24
@marigeo24 4 ай бұрын
@6:20 How can the voltage still be 5V across the 10k resistor if not connected to ground? If the voltage is still "running"(?) while unconnected to ground, then why wouldn't it power a device? @6:30 "...there is no Voltage drop across the 10k, the read Pin is going to see 5 Volts and is going to report back a 1." Are you saying that resistors ONLY limit current if the voltage is connected to ground?
@opalprestonshirley1700
@opalprestonshirley1700 5 жыл бұрын
Good explanation for the use of the pull up and pull down resistor. Really enjoy these projects. Thanks Paul.
@aleph.5811
@aleph.5811 4 жыл бұрын
Omg, thank you for taking time into explaining this at a lower level, thank you!!!
@MarcReeveNewson
@MarcReeveNewson 3 жыл бұрын
Somewhat more "compact" just because I know a command or two, maybe there are reasons not to do it this way. buttonRead = !digitalRead(buttonPin); Serial.println(buttonRead); digitalWrite(LEDPin, buttonRead); delay(dt); For those who don't follow, the "!" means NOT, so a 1 becomes a 0 and a 0 becomes a 1. I've put that in so that the light turns on when I push the button. And instead of using HIGH or LOW in my digitalWrite I'm passing my buttonRead to the function "naked".
@snakessnackssnakes
@snakessnackssnakes 4 жыл бұрын
Hey Paul, I really appreciate your videos. Thank you for taking the time to make them.
@ivancadena3031
@ivancadena3031 Ай бұрын
Paul, I just came across your YT channel. I must say that you're amazing and I have learned more from your videos than from a whole load of pages that do not care to explain clearly what needs to be done. Thanks a lot for your kind effort, Sir.
@harnoorsingh390
@harnoorsingh390 3 жыл бұрын
Sorry. I didn't hold my breath
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
So you are the one!
@harnoorsingh390
@harnoorsingh390 3 жыл бұрын
@@paulmcwhorter 🤠yup sir
@billcassels3951
@billcassels3951 Жыл бұрын
Iced coffee sucks!
@ob1895
@ob1895 11 ай бұрын
Thankyou Mr.McWhorter! At first our button did not want to work, but then it did. Also, we spotted then mistake you made with the dot and comma in the pinmode before you did and we were like, "Come on its right there! 🤣" very funny. Your lessons are amazing. Thankyou!!!!! :D
@melodybrown7087
@melodybrown7087 Жыл бұрын
GREAT TUTORIALS . I've learnt so much. Now I am wondering if i will learn enough to create a quiz game. How do I create 4 LEDS and 4 push buttons? I can find code that i can copy but i don't understand some of the commands. do you have any tutorials that will help me to understand how to create a quiz type game?
@To-mos
@To-mos 3 жыл бұрын
I laughed way harder than expected at "and I will move out of your way".
@elizabethmaulkin1512
@elizabethmaulkin1512 Жыл бұрын
Wonderful explanation, you really are a fantastic teacher, thank you so much. If anyone is reading this I have one problem; checked hardware and software many times, changed components BUT LED stays on all the time, checked input to pin 12 with multimeter and push button is working correctly. Any ideas please.
@TR-gr5uu
@TR-gr5uu 4 жыл бұрын
Dear Paul, are you dividing 5V by 0, when the latch is open (since U=IxR, and no current flowing)? I see that your instructions make sense, but I do not get the math behind it. Likewise, when the latch is closed, why suddenly U=0? Or does that mean that both values are simply tending towards the minimum/maximum values and you are applying some nasty calculus? Could you explain the math more indepth, like when explaining the LED in one of your first lessons, so that people with more rusty school math can get it too? Anyway thanks a lot for the great series! Big hug!
@kenmohler4081
@kenmohler4081 2 жыл бұрын
Paul - You gotta quit making me yell at you about INPUT vs OUTPUT and periods vs commas. But while I was doing that I now understand about pull-up and pull-down resistors. I had been using them working on the 8-bit computer with Ben Eater, but never really thought about the why. No voltage drop with no current flow. That is why they work. Thanks. Ken
@eparizi
@eparizi 9 ай бұрын
noob question here. does anyone know WHY we need the resistor here? Why 10K? I tried 5K and it still worked, but idk if there's a reason 10K is used. I also tried the pull up one WITHOUT the resistor, it does read the 1 when not pressed but the board disconnects as soon as I press. if we read the value of a 5V connected to the ground, it should be 0 with or without resistor, shouldn't it? Also if you know any good resources that would help with these kinda basic questions, I'd really appreciate it.
@ronkline8726
@ronkline8726 2 жыл бұрын
Thank you for this lesson !! I have learned to not completely tear down my breadboard after each lesson. So, for extra credit, I used my tri-colour LED. When a 0 was read, I turned on the RED LED. I know it is for special use, but when the button was depressed, I turned on the GREEN LED. Can I please get a green star? :-)
@sumantakumardutta986
@sumantakumardutta986 3 жыл бұрын
Thank you so much for explaining this topic so clearly.😀
@ryanryme1577
@ryanryme1577 3 жыл бұрын
I'm 7 years old and your coffee recommend is great and mom don't know.
@klaushansen5779
@klaushansen5779 3 жыл бұрын
hmm well you can do if statements but ive kinda cheated then i guess. void loop() { data=digitalRead(pushB); digitalWrite(redLed,data); } 2 lines in the loop will work tho
@jblade8252
@jblade8252 4 жыл бұрын
QUICK QUESTION...why use a resistor at all??wouldn't you see the same results with out a resistor????Is it because you would damage that pin if there was no resistor in circuit????
@ptipupu
@ptipupu Жыл бұрын
Merci ! Even for a French "English draft dodger" as I'm and thanks to your sterling prononciation I finally understood the function of this damned 10k resistance ... Thank you Sir.
@popiomondayz
@popiomondayz 4 жыл бұрын
so i outsmarted my self and i said that there was somthing wrong in the code... and i made my own UN-WORKING code and yeah.... thanks! [^v^]
@jsha6604
@jsha6604 3 жыл бұрын
hello, First of all your videos are amazing. I have a doubt that can we display two different output on lcd(16*2) with the help of arduino and two push buttons can you please give me the overview how to do this? it would be really helpful if you reply. Thank you
@garyhart6028
@garyhart6028 2 жыл бұрын
I had a bit of trouble, my switch worked I was getting '1' & '0' s, but my led wasn't lighting then I realised I'd put buttonPin rather than buttonRead in the if statement, to my defence it was only when the ledPin was going high, lol. I can't believe were on lesson 27 and going on to 28 already. Thank you again Paul.
@blackbeard9545
@blackbeard9545 Жыл бұрын
I actually can't get my values to switch between 1 and 0, depending on how I hook it up, I either get 1 or 0 on the open switch but pressing it has no effect. I don't have the exact same kit, but it's also an uno r3 starter kit. So I'm not sure if my button is making a proper connection, because the pins look a little short to reach down into the breadboard. I'll watch the video again, other than that, I'm not sure what to do. EDIT: I rewatched the video and my connections were just wrong.
Arduino Tutorial 28: Using a Pushbutton as a Toggle Switch
21:58
Paul McWhorter
Рет қаралды 292 М.
Arduino Tutorial 25: Understanding Photoresistors and Photo Detectors
36:19
Worst flight ever
00:55
Adam W
Рет қаралды 28 МЛН
Arduino Tutorial 20: Understanding RGB LED's
27:57
Paul McWhorter
Рет қаралды 162 М.
Arduino Tutorial 26: More Fun with Photo Resistors
31:38
Paul McWhorter
Рет қаралды 116 М.
Arduino Tutorial 32: Understanding and Using Joysticks in a Project
24:25
Restoring The ULTIMATE Rare Vise
24:45
Make Everything
Рет қаралды 37 М.
Arduino Tutorial 24: Understanding Passive Buzzers
21:56
Paul McWhorter
Рет қаралды 136 М.
Understanding Arduino Interrupts | Hardware, Pin Change & Timer Interrupts
48:17
Arduino Tutorial 17: Understanding Arduino While Loops
21:05
Paul McWhorter
Рет қаралды 193 М.
Arduino Tutorial 34: Simplest Way to Use a Pushbutton Switch
10:26
Paul McWhorter
Рет қаралды 100 М.
Arduino Tutorial 6: Build an LED Binary Counter
37:50
Paul McWhorter
Рет қаралды 450 М.
Google Pixel 8 Pro на 128 gb! Илии.... #shorts #shortvideo
0:20
UNIT | ЮНИТ | IPHONE 15
Рет қаралды 1,6 МЛН
Телефон - самая грязная ваша вещь
0:24
Up Your Brains
Рет қаралды 1,7 МЛН
😱ЭТО СМАРТФОНЫ SAMSUNG!
1:00
Thebox - о технике и гаджетах
Рет қаралды 2,1 МЛН