Arduino Tutorials: Control a LED with a Button

  Рет қаралды 405,767

HackTheWorld

HackTheWorld

Күн бұрын

Пікірлер: 244
@francescomendola
@francescomendola 4 жыл бұрын
int ButtonValue = 0; int Button = 3; int LED = 2; void setup(){ pinMode(Button, INPUT); pinMode(LED, OUTPUT); } void loop(){ ButtonValue = digitalRead(Button); if(ButtonValue != 0){ digitalWrite(LED, HIGH); }else{ digitalWrite(LED, LOW); } }
@dankymoose5334
@dankymoose5334 2 жыл бұрын
thanks bro
@domonkosimrik8051
@domonkosimrik8051 Жыл бұрын
Thx man this works well
@electronix6898
@electronix6898 5 жыл бұрын
Mine worked fine. Now, I need to figure out how to put 3 LEDs in there and control them with 3 different buttons. I'm trying to work on a cool little game where I put in a random pattern of 3 flashing LEDs and you have to remember the pattern and press buttons of that pattern. Just a little personal project.
@snow4562
@snow4562 2 жыл бұрын
tutorial please!!! 🥲🥲🥲
@electronix6898
@electronix6898 2 жыл бұрын
@@snow4562 ???
@snow4562
@snow4562 2 жыл бұрын
@@electronix6898 if you can do a tutorial video of your project 😅
@electronix6898
@electronix6898 2 жыл бұрын
@@snow4562 I did it but it's been a long time ago. Fortunately, I still have the breadboard setup, but it's so crappily put together
@snow4562
@snow4562 2 жыл бұрын
@@electronix6898 is it still working? I wanna try it too, I've been into Arduino lately, I've been searching for something cool that I can copy haha 🙈
@HamzaKhan-bg9fh
@HamzaKhan-bg9fh 6 жыл бұрын
The virtual sketch differs completely from the actual setup you had. Additionally, the virtual sketch does not work, and it is also the one you went by step by step, so people copied it in their own boards and that it why so many people have problems. You should have at least addressed why the sketch was different from the setup...I spent a while on this video and it ended up not amounting to much.
@cccp9661
@cccp9661 4 жыл бұрын
Agree
@MarkSMays
@MarkSMays 6 жыл бұрын
What tool are you using to draw wires between the processor and the breadboard? It’s very nice. Nice demo also.
@adilabusafa
@adilabusafa Жыл бұрын
أهلاً وسهلاً ومرحباً بك-يتعذر التعليق-لا أعلم .
@danieljonas2k15
@danieljonas2k15 5 жыл бұрын
bro, where can i get that amazing simulator? pls help... thanks!
@1ax
@1ax 5 жыл бұрын
@@adamidress558 shut up kid
@purrpsauce2236
@purrpsauce2236 5 жыл бұрын
@@adamidress558you suck bitch
@glebdubs
@glebdubs 5 жыл бұрын
You saved a project for which I worked for hours on - thank you so much! The fact that this video includes EVERY SINGLE LITTLE DETAIL that a lot of KZbinrs miss out is amazing, and that's what saved me hours of work! THANK YOU!
@patstarks
@patstarks 3 жыл бұрын
It looks like there is an extra wire in the animation. Nevertheless, I was still able to follow along and get the LED to light up! Great Content!
@-AhmedMohamedAhmedAhmedMohamed
@-AhmedMohamedAhmedAhmedMohamed 3 жыл бұрын
the orange and yellow ones?
@divyanshshaw6507
@divyanshshaw6507 3 жыл бұрын
I can use 220 oh resiston in this project
@himurakenshin2068
@himurakenshin2068 6 жыл бұрын
Not working . you did different connection on hardware and different on Design :3
@ezeq3693
@ezeq3693 3 жыл бұрын
it didnt work on mine too ://
@HowardRalston
@HowardRalston 4 жыл бұрын
Thanks for the video. Others I've watched had a different way to wire the button and my LED would come on randomly. Your connections fixed that!
@catacutanroselynb.5632
@catacutanroselynb.5632 Жыл бұрын
Thank you so much. This is the easiest and understandable demonstration video here in KZbin.❤
@ahmedumairan4706
@ahmedumairan4706 2 жыл бұрын
guys be careful when you plug in your 5v and gnd pins cause ive been trying to do this for 2 hours and i relised i didnt plug the 5v and gnd pins to the breadboard🙂
@johnslick8940
@johnslick8940 3 жыл бұрын
you are definetly not a smart one lol
@thepanda3757
@thepanda3757 3 жыл бұрын
the music is not helping to focus
@chanakyashukla5820
@chanakyashukla5820 2 жыл бұрын
firstly it is never called "le'-ed" it is an abbreviation and is always pronounced as L.E.D. (light-emitting diode), so never call it again "Le-d" because it is something else. Lead is an element with the scientific name Plumbum and symbol "Pb"; Atomic number: 82 Atomic weight: 207.19 Diodes are semiconductors not metal like the lead. Secondly, using a push switch to turn on or off the LED is so lame. I mean what else is the purpose of a "push switch" or be it any switch that exists. The switch simply cuts or completes the circuit. You can simply power 5V or 3V to an LED and if you add a switch to the circuit it will glow when pushed and will turn off when not pushed. What is the point of using a microcontroller then where is the automation? There should be at least different patterns of LED turning on or off when the button is pushed. make something challenging and use proper scientific language else a little confusion can create blunder mistakes.
@pimentomori259
@pimentomori259 10 ай бұрын
thank you so much, im just starting out with coding and my computer teacher is useless, taught me more here than half the semester has
@ThatOneRobloxDev
@ThatOneRobloxDev 2 жыл бұрын
I challenge you, make it so if you click it, it blinks multiple times, or when u click it, it stays on for 3 secs, OR even HARDER, make it fade when u click and stop fading when u release
@aminebenjalel7057
@aminebenjalel7057 Жыл бұрын
Thank you a lot !! You're saving me I have a project about it and this video is exactly what I searched !!! Thank you !!
@RickGreenPhoto
@RickGreenPhoto 2 жыл бұрын
STOP THE MUSIC!! Really the music made this hard for me to follow taking a level 2 project to level 4...
@neelammasand3627
@neelammasand3627 4 жыл бұрын
Next Time can you please give a link for the code
@MrBobWareham
@MrBobWareham 4 ай бұрын
Loved the video but not the music, it makes it hard to concentrate on what you are saying, no music please.
@deva8496
@deva8496 2 жыл бұрын
I am trying this since last 24 hours using 220ohm and 10kohm resitters but no luck. let me try this as last attempt and I am givving it up forever.
@wajihasaleem
@wajihasaleem 2 жыл бұрын
can you share the code
@DarlingbroughModelRailway
@DarlingbroughModelRailway 2 жыл бұрын
Thank you! I've been struggling with the if function, but this video has explained it to me in a way I understand! Subbed!
@pedrinho32286
@pedrinho32286 6 жыл бұрын
Impecável José. Bem que estava a reconhecer um sotaque Português. Bom vídeo
@frogoverlord5342
@frogoverlord5342 6 жыл бұрын
e nóis
@Luis3alsa
@Luis3alsa 3 жыл бұрын
Vim logo aos comentários para confirmar isso 😂
@tomasfranco4870
@tomasfranco4870 3 жыл бұрын
bem me parecia ahah
@JurassicBattleDroid
@JurassicBattleDroid 4 жыл бұрын
“Easy”
@Napoleonrevolution
@Napoleonrevolution 3 ай бұрын
It can't send because of MY GODDAMN CONNECTION
@engravingoffaustspactwithm4648
@engravingoffaustspactwithm4648 2 жыл бұрын
Thanks so much i learned so much thanks and can't i change Arduino by Arduino nano??
@thomastekfeldthansen4606
@thomastekfeldthansen4606 5 жыл бұрын
3:03
@etche1897
@etche1897 2 жыл бұрын
what if instead of connecting a led i want to turn on my computer with that button? How would I do that?
@nikokvashali6910
@nikokvashali6910 7 ай бұрын
sheni dedbili dewdasheveci ras aswavli tuarici sheni dedis sisxli movtkan
@mehriniso4745
@mehriniso4745 2 жыл бұрын
where code
@niko587
@niko587 3 жыл бұрын
why not just connect a rezistor to the button there is no need for code i got baited i tho its a switch
@alexwilhelm9182
@alexwilhelm9182 3 жыл бұрын
Remarkable Video! Will be showing this to my son who is currently using Embedded Learner Board by Moonshot Jr. Never thought that understanding Arduino and related coding can be made so easy. Thank you for this video.
@industrialelectricalbd6900
@industrialelectricalbd6900 2 жыл бұрын
if("ButtonValue ! =0") now will be compilling.
@Ali_Alhakeem
@Ali_Alhakeem 7 ай бұрын
Ok this was really helpful , figured out i didn't use resistor and it works now thank you !
@michelarens7766
@michelarens7766 2 жыл бұрын
Great video! What software are you using?
@CrazyGreekGR
@CrazyGreekGR 4 жыл бұрын
Programm name for showing how to connect the things on the Breadboard?
@MrKbtor2
@MrKbtor2 11 ай бұрын
Answered my question that the kit I was using didn't
@x-x1329
@x-x1329 2 жыл бұрын
Thanks. I would like to know how many ohms of the resistor 3:19.
@MuAlamedy
@MuAlamedy 7 ай бұрын
220ohm
@ollollo782
@ollollo782 2 жыл бұрын
he said "a LED" not, "An L.E.D." kzbin.info/www/bejne/oaSxk3irnbRnnLc
@Hektowa
@Hektowa Жыл бұрын
If my button is a little too big can I use a connector to do it?
@deva8496
@deva8496 2 жыл бұрын
how does your board do nothing when you are connected to pc? my aurdiono keeps running old code that is uploaded. what is the trick here?
@freethepotato
@freethepotato 2 жыл бұрын
Well, probably I had a blank or default Arduino project running. But the behavior you described is expected. The current Arduino code starts running when you power it on.
@coffin7904
@coffin7904 5 жыл бұрын
Dude what the fuck why is your circuit so different from your planned layout? Thats not helpful
@coffin7904
@coffin7904 5 жыл бұрын
Your code is very clean tho.
@chbonnici
@chbonnici 6 жыл бұрын
Very nice explanation but please switch the music off for better concentration. Thank you. Thumbs up
@freethepotato
@freethepotato 6 жыл бұрын
Will do, thanks for watching! :)
@RifaiAL
@RifaiAL 5 жыл бұрын
Can you help me build an RGB LED strip strobe light for use with my levitating water effect project? The color combination of RGB strobe LED's must be selectable.
@vincent8368
@vincent8368 3 жыл бұрын
no
@henrybirdseye
@henrybirdseye 4 жыл бұрын
Your effort is appreciated, but background music detracts from the message.
@anokhautomation4453
@anokhautomation4453 2 жыл бұрын
The LED must stay ON even you release the button. Then the second press,LED should go OFF.
@peterberrig2010
@peterberrig2010 4 жыл бұрын
What is the name of the program you are using to Draw in? :)
@ciscomarte
@ciscomarte 4 жыл бұрын
Hey, I used fritzing and after effects. Thanks for watching
@peterberrig2010
@peterberrig2010 4 жыл бұрын
Jose Dias thank you😊 thank you for the wonderful video 😊
@peterberrig2010
@peterberrig2010 4 жыл бұрын
And i must say that you are amazing to explain!😊
@mrsirbugs
@mrsirbugs 4 жыл бұрын
Why in blazes do people who post instruction videos feel the need for all that stupid distratiing music. Lose the music then we can consentrate on what you're saying. Imagine the Almigjty God giving Moses the 10 Commandments with ACDC or the STONES blaring in the background.
@ThatOneRobloxDev
@ThatOneRobloxDev 2 жыл бұрын
i tested it with a Leonardo and a (3rd party ELEGOO) uno rev3, it works both ways, the leonardo is the original, its cpu is all rusted a bit, i think it's from 2013 or 2014, and its a leonardo, made in italy
@nickjames9264
@nickjames9264 7 жыл бұрын
Thanks, its working but I'm confused. Why do we don't need a connection from from anode of LED to +5V?
@ali_the_maze_master
@ali_the_maze_master 3 жыл бұрын
Arduino: 1.8.15 (Windows Store 1.8.49.0) (Windows 10), Board: "Arduino Uno" sketch_jun07a:21:3: error: expected unqualified-id before '{' token {else ^ exit status 1 expected unqualified-id before '{' token This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. this keeps happing to me
@claudidi95
@claudidi95 6 жыл бұрын
Este sotaque não engana ninguém, tinha de ser português, ;)
@gpmscosta
@gpmscosta 5 жыл бұрын
Exactamente, estava a pensar no mesmo xD
@robertmarkham6558
@robertmarkham6558 6 жыл бұрын
Very good at explaining things, I've spent the last week trying to write a script and it all fell together then i saw you Showing how it works, Thanks!! Subed!!
@Escuier
@Escuier 3 жыл бұрын
Too much useless wiring make the whole thing needlessly confusing for a begineer. Also, as mentioned in other comments the diagram doesnt work and is actually different thom the demo hardware.
@virathiyam5401
@virathiyam5401 2 жыл бұрын
Well done my bro.. liked & supported.. I want to ask.. what is the technical name of the 4 leg switch when you push once-led glows dim, push twice-led glows bright, push thrice-led shuts off? The push button on my led lamp stopped woking and I need the name to search and order it in Amazon. I'm not an electrical engeneer so I don't know the name.. plz help out.
@yacinehamitou4511
@yacinehamitou4511 3 жыл бұрын
did the same but doesnt work waste of time
@sailochan1203
@sailochan1203 4 жыл бұрын
IT IS NOT WORKING !!!!!!!!!
@DKYtut
@DKYtut 4 жыл бұрын
Hello I did exactly the same as the video, but I have a small problem: - If i 'Touch' my button my LED will light up. - if I press my button the led will turn off I hope I hear an answer soon, thanks
@playlistmaster-thebestplay3605
@playlistmaster-thebestplay3605 Жыл бұрын
what can I say, man, HELPED ME OUT, thanks so much man, I needed to watch this fantastic video so I could control my Piezzo element
@ThatOneRobloxDev
@ThatOneRobloxDev 2 жыл бұрын
i dont even have any pullup / pull down resistors, i do have normal resistors from 10 resistance to 5 million tho
@planethedgehog2427
@planethedgehog2427 3 жыл бұрын
Good video. By the way, it's "an LED," pronounced "an el ee dee." LED is an initialism, read aloud as three separate letters.
@krishaykondapalli9693
@krishaykondapalli9693 2 жыл бұрын
My issue is that I have an attachable power supply rather than an arduino board. Could you still use the attachable power supply?
@bullet_7717
@bullet_7717 2 жыл бұрын
Really nice! But i have a question, if i want to do the opposit? Namely, with the button not pressed the led must be on, with the button pressed led must be off. In other words, I would like the button to be as normally closed.
@Alex-fk2ie
@Alex-fk2ie 4 жыл бұрын
I wonder that i've read some code and they said differntly about the LOW HIGH state of the button.Some said that when we pressed , the state of the button == LOW, some said the opposite.Can you explain it clearly :'(
@tnxeedihniurndu
@tnxeedihniurndu 2 жыл бұрын
Can you try with a maker uno x?
@user_Francisco
@user_Francisco Жыл бұрын
What resistors should I use?
@aakashdewangan7313
@aakashdewangan7313 3 жыл бұрын
don't add background music
@curiousminds668
@curiousminds668 2 жыл бұрын
At 2:43 , the direction of the current flow is wrong I think. It should be from Vcc to arduino
@technicaltransistor2658
@technicaltransistor2658 3 жыл бұрын
Hi bro in which software you make arduino board circuit
@michaelbean2712
@michaelbean2712 5 жыл бұрын
Doesnt work at all...what a waste of time...there seem to be 2 completely different videos here.
@rinopro5556
@rinopro5556 6 ай бұрын
Thank you so much, you explained it in such an easy way!
@salc9593
@salc9593 2 жыл бұрын
Thank you for posting this video I found it informative. I would like to ask IF the code you wrote can be used to begin a Sketch?
@ARTEJFM
@ARTEJFM Жыл бұрын
con esta simple rutina, hay problemas de rebote de pulsación
@firdodev
@firdodev 3 жыл бұрын
What simulator you use?
@dalemarriott2328
@dalemarriott2328 3 жыл бұрын
But why ? Just connect the led to a battery via the switch and a resistor ... Arduino is a waste of time and money
@adamhall7077
@adamhall7077 3 жыл бұрын
Not really.... I made a game console with one.
@dalemarriott2328
@dalemarriott2328 3 жыл бұрын
@@adamhall7077 to just light an led it's a waste
@adamhall7077
@adamhall7077 3 жыл бұрын
@@dalemarriott2328 He was using it as a way to demonstrate the concept.
@jefverreydt2059
@jefverreydt2059 3 жыл бұрын
thx man! great vid
@harunasairenji5846
@harunasairenji5846 3 жыл бұрын
Gak bisa bahasa Inggris.
@flosset9640
@flosset9640 5 жыл бұрын
When i tried to do the sketch it didnt work
@ScitiveX
@ScitiveX 5 жыл бұрын
What problem ? please share your setup and arduino code
@hitarthvyas7860
@hitarthvyas7860 3 жыл бұрын
Can someone explain why he connected the button to the 5V pin?
@tjp1432
@tjp1432 4 жыл бұрын
i need help please i have made a 5 pin midi pedal with nano and buttons how do i add led to each button
@kmhooibg7577
@kmhooibg7577 2 жыл бұрын
Thank you very very very very very much! I've been struggling with the button controlling function! But this video has explained it to me in a way I understand! Liked!
@arsadnadzjars.7799
@arsadnadzjars.7799 Жыл бұрын
wheres the code?
@guyclykos
@guyclykos 2 жыл бұрын
Oh... That's why.
@liberte_fear6442
@liberte_fear6442 3 жыл бұрын
thanks for m'y first try in the arduino universe ;)
@JoostArchives
@JoostArchives 2 жыл бұрын
You absolute life saver. I LOVE YOU
@alinefeudjio2730
@alinefeudjio2730 4 жыл бұрын
it doesnt work . dislike
@OTugas
@OTugas 6 жыл бұрын
Help ... Why is the spot (15;C) connected diagonaly?
@marlonhimasha9593
@marlonhimasha9593 3 жыл бұрын
thanks man..!!!
@omarrashads7888
@omarrashads7888 3 жыл бұрын
Can i get the b design simulation program?
@muhamadilinurhayatbinhassa9204
@muhamadilinurhayatbinhassa9204 2 жыл бұрын
what app do u used for circuit simulator??
@sivabharathi1211
@sivabharathi1211 2 жыл бұрын
Thankyou 😁
@Dasgath
@Dasgath 5 жыл бұрын
the diagram and the connection you did are different. Switched ground and pin in the connection for the led... and still works?
@Dasgath
@Dasgath 5 жыл бұрын
Anyways eems like it doesnt matter where you put the resistor, since it is in series it shares the load with the led. Thanks for the tutorial, finally managed to make mine work, i had a bad wire and spent 2 hours trying to figure out what the fuck was going on. Guess i need to learn how to do the serial monitor.
@fergspan5727
@fergspan5727 7 жыл бұрын
Now latch it by only when the button is pressed once the light stays on and when pressed again it turns off ?
@sitinurbaya6157
@sitinurbaya6157 5 жыл бұрын
Hi! i followed the schematic for the breadboard but when i tried to upload the code it gave me error! a help would be greatly appreciated
@athsararajakaruna3958
@athsararajakaruna3958 2 жыл бұрын
Thank you
@dainazinas
@dainazinas 7 жыл бұрын
Challenge accepted!. Same thing using internal pullup resistor ;]
@freethepotato
@freethepotato 7 жыл бұрын
Yes! I should have mentioned arduino has internal pullup resistors.
@timkardaras8007
@timkardaras8007 2 жыл бұрын
Amazing video! thank you!
How to Use a Button with an Arduino (Lesson #5)
20:57
Science Buddies
Рет қаралды 83 М.
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 58 МЛН
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 102 МЛН
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 30 МЛН
From Small To Giant Pop Corn #katebrush #funny #shorts
00:17
Kate Brush
Рет қаралды 71 МЛН
Push Button and LED control with the Arduino
4:38
Maker 101
Рет қаралды 333 М.
Arduino Tutorial 28: Using a Pushbutton as a Toggle Switch
21:58
Paul McWhorter
Рет қаралды 292 М.
You can learn Arduino in 15 minutes.
16:34
Afrotechmods
Рет қаралды 10 МЛН
How to Use a Breadboard
12:21
Science Buddies
Рет қаралды 3,1 МЛН
8x8x8 LED CUBE WITH ARDUINO UNO
6:46
HARRY LE
Рет қаралды 15 МЛН
Arduino Basics 102: Control Structures, Variables, Interrupts
7:38
Arduino - Turn LED On and Off With Push Button
23:33
Robotics Back-End
Рет қаралды 124 М.
Arduino Basics Handling Multiple States
10:35
learnelectronics
Рет қаралды 120 М.
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 58 МЛН