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); }
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.
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
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!
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
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!
Question - let’s say the void loop controls 5 LEDs each doing its own thing (blinking, flashing, etc.) and the loop takes 30 seconds to complete. If I wanted a button to control 1 of the LEDs (change it’s flashing rate), will the button need to be pressed while the code is executing that line of code, or will the program remember the button press and execute when the line of code comes around? Second - if the actions of the LEDs are separated with a “delay” does that cause more problems ? Would “millis” be better ? I enjoy your videos, thanks
Im trying to make a sequence where it takes button one then button two and so on but not out of order do you have a video that would help thank you very much for the videos there helping a tun
I need a bit of help, my project wasn't working so i can here. It was very useful but didn't fix my issue, everything works but the led won't turn off. Here is my code: const int analogPin = A0; const int oneThreshold = 102; void setup() { Serial.begin(9600); pinMode(1, OUTPUT); } void loop() { int analogValue = analogRead(analogPin); if (analogValue > oneThreshold){ digitalWrite(1, LOW); } else{digitalWrite(1, HIGH); } Serial.println(analogValue); delay(1); } If you have any idea of why this isn't working I would be very happy if you could help. Thanks!
Nice explaination... Bro solve my problem,when input high, i want output led blink only once for 2 seconds,, but here i getting problem it always repeating....i want just like trigger.....Plz reply bro
I thought I was going crazy, but now I see the switch has 3 wires instead of 2. Now I am wondering if you can use a 2 wire switch with arduino? Hmmmm........
Hey is it possible to use memory values something like int DynamicMemory = (Values here) if (DynamicMemory < 90%... I think you got it, im trying to make a memory error to my project but i cant find out how...
error. expected '}' at end of input. its show the above error when I try to compile the sketch. my full sketch is below. please help. int button = 7; int led = 8; void setup() { pinMode(button, INPUT); pinMode(led, OUTPUT); } void loop() { if(digitalRead(button) == HIGH ){ digitalWrite(led, HIGH); } else{ digitalWrite(led, LOW); }
add one more " }" at the end of your code and it's fixed :) This is why i use indents in my code, it helps me keep track of which brackets belong to which statements.
I do exactly what he says but then when its uploaded the led lights up even if i did not press the button and i wired it exactly as he did here is my code: int button = 8; int Led = 4; void setup() { pinMode(Led, OUTPUT); pinMode(button, INPUT); // put your setup code here, to run once: } void loop() { if(digitalRead(button) == HIGH){ digitalWrite(Led, HIGH); } else{ digitalWrite(Led, LOW);
Why is this telling me I don't have a previous 'if' statement? void loop() { if(digitalRead(button)==HIGH);{ digitalWrite(led, HIGH); delay(600); digitalWrite(led, LOW); delay(600); } else(led, LOW); }
I'm checking the comments to see if anyone else has the if and else statement working but with the opposite effects of led on and off pattern. The only confusion that could cause this result is my LOW and HIGH statement as far as I can tell, I've also checked INPUT and OUTPUT but...opposite on off pattern achieved. So illogical!
I'm using your precise code but I'm using a basic 2 wire switch instead of a actual button since buttons weren't sent as specified in my kit. I believe that is my problem. Without following your directions to the T I won't use your time. Thank you so much for the tutorials and reply!
If there is a compiling error check the text at the bottom of the software, it should tell you where your error is located. As you can see in the video, if the code is entered correctly, it works. Good luck! :)
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);
}
I love when commenters submit their code. Thanks!
It only took two videos from your channel to understand WHY each action acts certain way. It was the clearest simplest explanations.
u a nerd
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.
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
I find that the way he words the explanation and highlights things makes a lot of sense to me than other videos
glazing
Hallelujah is right...it finally sank in! I'm going to watch more of your videos. Thank you Sir!
me too :)
Yeah this is incredibly clear, and simplified. Thank you. Everyone else ive seen makes this overly complicated.
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!
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!
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
you really have a perfect teaching style
Thank you for these videos. I'm binge watching them all!
Glad they were helpful!
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!
Excellent video! Easy to follow and I got the same results. Thanks!
i like your way of explaining, its so easy to follow 👍
It's amazing how you can teach so well with short videos. Thank you from Brazil!
Lovely to hear, thanks Luiz! You're welcome from the UK haha.
Good video, the way you explained was easy to understood. 💐
What you call "brackets" are parenthesis; and what you call "squiggly brackets" are actual brackets.
Other than that, great video series :)
gotta have some fun with it, squiggly brackets is where it's at! :P :)
Great Video, I'm trying to apply an IF statement to extend an actuator with a particular fingerprint and retract with another fingerprint. any advice?
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.
hey, How do you program multiole if statements that faction as a AND program(If x
you're videos are perfect, awesome work!
It is an easy explanation...
Thank You...
Very nice video sir......
Great explaination
Please also make a video on else statement
thank you you are amazing i learned so much it the best channel on youtube
hahaha this guy is really good with the if statements and the music selection
i really liked the song at the end hahahahahah
Love ❤😘 u sir from India 🇮🇳 ur tutorial r excellent
very very thank you for making such amazing videos.
Another excellent video !
Thank You so much for your hard work here. It is appreciated ...
Question - let’s say the void loop controls 5 LEDs each doing its own thing (blinking, flashing, etc.) and the loop takes 30 seconds to complete. If I wanted a button to control 1 of the LEDs (change it’s flashing rate), will the button need to be pressed while the code is executing that line of code, or will the program remember the button press and execute when the line of code comes around?
Second - if the actions of the LEDs are separated with a “delay” does that cause more problems ? Would “millis” be better ?
I enjoy your videos, thanks
Im trying to make a sequence where it takes button one then button two and so on but not out of order do you have a video that would help thank you very much for the videos there helping a tun
thank you very much, for this tutorials !
Thank you very much!!!!! I was having problems with this command.
jajaja Aleluya... A....Leluya. Fantasstic way to explain something trivial. Like it very mutch. Tks 4 this
Thank you for these videos it helped me a lot. SUBSCRIBED
You have a new subscriber
You are doing a great job!!
why we connected a ground to button? what is its purpose??
Ты лучший! Спасибо большое ❤
I need a bit of help, my project wasn't working so i can here. It was very useful but didn't fix my issue, everything works but the led won't turn off.
Here is my code:
const int analogPin = A0;
const int oneThreshold = 102;
void setup() {
Serial.begin(9600);
pinMode(1, OUTPUT);
}
void loop() {
int analogValue = analogRead(analogPin);
if (analogValue > oneThreshold){
digitalWrite(1, LOW);
}
else{digitalWrite(1, HIGH);
}
Serial.println(analogValue);
delay(1);
}
If you have any idea of why this isn't working I would be very happy if you could help. Thanks!
This is super💯💯💯thank you very much
What about if I want to add another condition to the if, an "and" how would I do it?
Nice explaination... Bro solve my problem,when input high, i want output led blink only once for 2 seconds,, but here i getting problem it always repeating....i want just like trigger.....Plz reply bro
You have to not use void loop
Nice and well explained
Great tutorial.. Thank you. You have a new sub
I thought I was going crazy, but now I see the switch has 3 wires instead of 2. Now I am wondering if you can use a 2 wire switch with arduino? Hmmmm........
how to code with 3 inpute electronics in 1 code?
well explained!! thanks you!!
Hey is it possible to use memory values something like
int DynamicMemory = (Values here)
if (DynamicMemory < 90%...
I think you got it, im trying to make a memory error to my project but i cant find out how...
What is the meaning of 'int'?
integer, it means a whole number
amazing videos. thank you so much bro.
error.
expected '}' at end of input.
its show the above error when I try to compile the sketch.
my full sketch is below. please help.
int button = 7;
int led = 8;
void setup() {
pinMode(button, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
if(digitalRead(button) == HIGH ){
digitalWrite(led, HIGH);
}
else{
digitalWrite(led, LOW);
}
add one more " }" at the end of your code and it's fixed :)
This is why i use indents in my code, it helps me keep track of which brackets belong to which statements.
@@benduino7327 thanks it worked. :)
INPUT_PULLUP!!!!
Your are really great
How do I make a girlfriend?
{If(Fate,meet + girl)}
@@muhammadsyakirahmadzaki8657 😂😂😂🤣🤣🤣
@@muhammadsyakirahmadzaki8657 = still single
I do exactly what he says but then when its uploaded the led lights up even if i did not press the button and i wired it exactly as he did here is my code: int button = 8;
int Led = 4;
void setup() {
pinMode(Led, OUTPUT);
pinMode(button, INPUT);
// put your setup code here, to run once:
}
void loop() {
if(digitalRead(button) == HIGH){
digitalWrite(Led, HIGH);
}
else{
digitalWrite(Led, LOW);
}
// put your main code here, to run repeatedly:
}
THANK YOU FOR THE VIDEO
Why is this telling me I don't have a previous 'if' statement?
void loop() {
if(digitalRead(button)==HIGH);{
digitalWrite(led, HIGH);
delay(600);
digitalWrite(led, LOW);
delay(600);
}
else(led, LOW);
}
no semicolon after if(digitalRead(button)==HIGH), that will fix it
also use square brackets for the else statement not "( )"
Thanks!
Music name please
EDIT: 0:24
now i know, thanks bro
works good
Amazin!!
I'm checking the comments to see if anyone else has the if and else statement working but with the opposite effects of led on and off pattern. The only confusion that could cause this result is my LOW and HIGH statement as far as I can tell, I've also checked INPUT and OUTPUT but...opposite on off pattern achieved. So illogical!
Paste your code and I will see if there is anything that could explain it :)
I'm using your precise code but I'm using a basic 2 wire switch instead of a actual button since buttons weren't sent as specified in my kit. I believe that is my problem. Without following your directions to the T I won't use your time. Thank you so much for the tutorials and reply!
your code didnt work it has errors
If there is a compiling error check the text at the bottom of the software, it should tell you where your error is located. As you can see in the video, if the code is entered correctly, it works. Good luck! :)
thinx bro
Teach slowly..i cant grab ur words...😀😅
Sir i want pdf of tutorials ple