Arduino Uno R4 WiFi LESSON 16: Understanding If Statements and Conditionals
ฝัง
- เผยแพร่เมื่อ 11 ก.พ. 2025
- Pick your Sunfounder kit up so you get the same results I do:
amzn.to/3SciApZ
You can pick up the neat jumper wires I showed in the video here:
amzn.to/3U2vyIe
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:
/ paulmcwhorter
In this video I show you how use If Statements in Arduino. We will look at the various conditional that can be used, and we will explore compound conditionals using 'and' and 'or' logical commands. Enjoy!
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. ]
#arduinor4wifi
#ifstatements
#tutorial
Now, I am following the Arduino R3 tutorials, but I came here to tell you that you are the best teacher I have ever seen
Wow, thanks!
3 words:
Amazing
Amazing
Amazing
I Really learned from you Mr. Paul, and I would love if you made serial videos about ESP32 using MicroPython or arduino, or both
Thank you
Most programs need to use if statements and conditionals, so this is another important lesson!
2 tips: 1. clear monitor window before each run. 2. include a print to show what number you entered, hard to see on the line where you enter the value and goes by quick. Nice work.
Good morning from Washington state. Thanks for the lessons!
You might want to indent - Conditional statements, while, for statements to give your code some formating. You will find it easier to read
Great Lesson. I aced the homework.
Brilliant Paul, thank you so much 😊 👍🏼
Sir when will you have to make videos on how to use the esp32
Hi Mr McWhorter, Do you can help me with a Bluetooth Module HC05, to set Role Master? I cannot change the role, please help me
I've used if else during this tutorial, instead several if conditions
Thank you Paul
👍
i lost the meaning of "Serial.parse", what is "Parse" standing for?
Parse means to split apart. You could split out an integer from a string by writing a program to look at the string character by character. You would be looking at each character to see if it was a number. You would have to be mindful of the minus sign. Years ago, 1968 to be exact, I did just that with the original Dartmouth BASIC.
@@robertschuldenfrei2402 oh ok got it! Many thanks! :)
👍👍
For typing OR in Windows - type twice Alt+124
wikipedia... One 0 (zero) is a number representing an empty quantity. Adding 0 to any number leaves that number unchanged. 🤞 Twilight zone stuff.
More Comments for TH-cam juice!
My Homework th-cam.com/video/52rodJoi7eA/w-d-xo.htmlsi=f_djVs8j0s2FAlNb
I tried to set up the code so any input other than red, yellow and green would turn off the LEds and give a message like "there is no such LED", like:
if (colInput !="red" || colInput !="green" || colInput !="yellow"){
digitalWrite(rPin,LOW);
digitalWrite(gPin,LOW);
digitalWrite(yPin,LOW);
Serial.print("there is no such LED"); }
But this doesn't work. Any suggestions?
LEGEND!
Hi Richard, && not ||
Thank You Robert! Yes, this worked but I still don't understand the logic behind it.@@robertschuldenfrei2402
@@richardsstark9825 Here is the logic behind it. In the || (or) construction if the color you entered is "red" it fails the first test since the color IS red, but it passes the second test because red is not "green." Even if the red LED was turn on in an earlier test like if(colInput="red") it will be turned off immediately when it hits your "or" constructed statement.
If you want to learn Arduino programming at a much deeper level than Paul can do in this course I recommend a very elementary book: Sams Teach Yourself Arduino Programming in 24 Hours by Richard Blum. Even if you have never written a program before you could learn how it is done with this book. You will come to understand why some function look like loop() and others look like myValue.toInt(). [answer: the first is a function and the second is string object method]
My lesson 16 homework assignment: th-cam.com/video/nYkF0IMNQwE/w-d-xo.html
LEGEND!
My ArduinoR4 homework 16 th-cam.com/video/CWhfxXDP6s8/w-d-xo.html. Thanks Paul. I used a blinkLED function. Paul has recently gone over functions classes and methods in the PicoW series approximately lesson 64. I thought it would be a challenge to see if I could do it in the Arduino IDE.
LEGEND!
Enjoyed your If Satement lesson, here is my homework for lesson 16 :- th-cam.com/video/S9u7Y60q7Bs/w-d-xo.html
LEGEND!
HW link Try #56: th-cam.com/video/m9ZJnMYjYao/w-d-xo.html
Its been a while, glad to see your homeworks once again.
@@paulmcwhorter I seem to have found a link that did not get rejected this time. It continues to be a problem ...
Finally got the video to stick. th-cam.com/video/hKybxCN254Y/w-d-xo.html
LEGEND!
LEGEND - th-cam.com/video/nh58xa94XrY/w-d-xo.html
Excellent!
Wrong James Cameron LoL
Thanks, Paul, for another great tutorial. Homework completed: th-cam.com/video/cxRd81L6n_U/w-d-xo.html
Nicely done.
Excellent lesson as usual. Homework complete th-cam.com/video/rDCG9vGABpY/w-d-xo.html Many Thanks!!
LEGEND!
studio.th-cam.com/users/videoJlQ49ifHXz8/edit Homework lesson16
I got it! Didn't open the laptop till after the lesson was over and started fresh.
th-cam.com/video/4dHz5QMXcwk/w-d-xo.htmlsi=4RkbI_kSk4pdqE_W
LEGEND!
Homework done.
th-cam.com/video/CJZR0kM8kcs/w-d-xo.html
LEGEND!