Arduino Lesson 4 - If Statements

preview_player
Показать описание
The 4th in a series of tutorials to help you understand the basics of the Arduino uno. In this session we will be covering if statements in the context of digitalReads. By the end of this session you will be able to write code to turn and LED on and off using a button. You can apply this theory to a number of more complex functions which we will go over in the next tutorial.

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

It only took two videos from your channel to understand WHY each action acts certain way. It was the clearest simplest explanations.

theteddy
Автор

perfect video, thanks a ton man! 36 yrs old and still learning this stuff. Sharing my sketch in case anyone needs it

int led = 13; //default LED pin, external led can also be connected to pin 13
int vs = 9; //assigned vibration sensor to pin 9

void setup() {

pinMode(led, OUTPUT);
pinMode(vs, INPUT);
Serial.begin(9600);
}

void loop() {
if (digitalRead(vs) == HIGH) {
Serial.print("Status - ");
Serial.println("shake detected!");
digitalWrite(led, HIGH); //lights up Pin 13 or externally connected LED
delay(1000); //delay before scanning again for shakes
}

else
(digitalWrite(led, LOW)); //turn off led while scanning
Serial.println("ready");
delay(50);
}

jomac_ph
Автор

I find that the way he words the explanation and highlights things makes a lot of sense to me than other videos

kevinolvera
Автор

Gotta be honest, I really like your tutorials. I've been more of a coder throughout life so that part is easy for me, but I really need a tutorial on how you know to set up the wiring on the board.

degarmo
Автор

You teached me arduino better than my colege teacher did in 2 years so congrats to you clear instruction now you have a whole class waching your videos

xcharismagaming
Автор

Hallelujah is right...it finally sank in! I'm going to watch more of your videos. Thank you Sir!

tonyverduga
Автор

Yeah this is incredibly clear, and simplified. Thank you. Everyone else ive seen makes this overly complicated.

growponics
Автор

Thank you for these videos. I'm binge watching them all!

LegalSkateboarding
Автор

you really have a perfect teaching style

MrBarca
Автор

i learned MORE in these 7:25 seconds than weeks of other videos.I can say just from this 1 video...I GET IT NOW!!! Thank you
Keep the Vids coming!

Frightline
Автор

I'm getting started with Arduino kinda late, but I've been watching several videos trying to learn about coding and today thanks to you for this video, I wrote My First if/else code, and it works perfectly. Thank you the simple coding lesson

HPFPVS
Автор

GREAT HELP! The project in the example wasn’t what I was doing, but needed help to format the code as arduino was a topic we lightly touched on in my digital class, fixed my issue with a nice if else statement!

Benjibits
Автор

I learned basic BASIC as a teenager. I really miss the GOTO statement. This if else m'larky is making my head hurt but this has got to be the best simplification of it I have come across and short too. Thanks!

Godshole
Автор

It's amazing how you can teach so well with short videos. Thank you from Brazil!

luizr.rabello
Автор

i like your way of explaining, its so easy to follow 👍

szarel
Автор

Excellent video! Easy to follow and I got the same results. Thanks!

christiankomodo
Автор

What you call "brackets" are parenthesis; and what you call "squiggly brackets" are actual brackets.
Other than that, great video series :)

thalesbarbosa
Автор

Thank you so much, i am new to arduino and couldnt figure out why it was saying "error status 1" or whatever it was. this was the reason.

squidboi
Автор

It is an easy explanation...
Thank You...

shamimayesmin
Автор

very very thank you for making such amazing videos.

pritichowdhury