Arduino Basics 102: Control Structures, Variables, Interrupts

  Рет қаралды 488,583

GreatScott!

GreatScott!

7 жыл бұрын

Support me for more videos: / greatscott
Previous video: • DIY Portable LED Panel...
Arduino Basics 101: • Arduino Basics 101: Ha...
Facebook: / greatscottlab
Twitter: / greatscottlab
You can get Arduino boards here (affiliate links):
Aliexpress:
Arduino Uno: s.click.aliexpress.com/e/_dT2...
Arduino Nano: s.click.aliexpress.com/e/_dUL...
Arduino Pro Mini: s.click.aliexpress.com/e/_d62...
FTDI board: s.click.aliexpress.com/e/_dV4...
Ebay:
Arduino Uno: rover.ebay.com/rover/1/711-532...
Arduino Nano: rover.ebay.com/rover/1/711-532...
Arduino Pro Mini: rover.ebay.com/rover/1/711-532...
FTDI board: rover.ebay.com/rover/1/711-532...
Amazon.de:
Arduino Uno: amzn.to/2ljDLFL
Arduino Nano: amzn.to/2ljnq3J
Arduino Pro Mini: amzn.to/2kMv0ly
FTDI board: amzn.to/2ljvuRY
In this second epsiode of the Arduino Basics video series I will talk about control structures like if, for, while and switch and how to use them in combination with variables to create more advanced code. At the end I will also talk about why interrupts are so important and how to use them as well.
Music:
In the Hall of the Mountain King, Kevin MacLeod
Ecstatic Wave, Jens Kiilstofte
machinimasound.com/music

Пікірлер: 422
@Nerdforge
@Nerdforge 7 жыл бұрын
Arguably one of the best thorough introductions to Arduino I have seen. I like the parts where you include "why use a microcontroller" and not a circuit for specific uses. With a computer science background it's hard to not always use a microcontroller, but many times it seems like it can be obsoleted.
@greatscottlab
@greatscottlab 7 жыл бұрын
I am glad you liked it. Looking forward to your next projects ;-)
@mj2068
@mj2068 3 жыл бұрын
well said. but, "obsoleted"?, you mean overkill, huh? xD... (btw, love martina's mythical purple hair)
@JariOrSomething
@JariOrSomething 7 жыл бұрын
As a developer and i already know these things, i love it. Scott you make great tutorials for people to understand the basics. The things you explain works for a lot of programming languages! keep it going man!
@TheHandsomeRyan
@TheHandsomeRyan 5 жыл бұрын
I learned more about reading and writing arduino programs in 7:37 than I have from hours of watching other tutorials. Thank you!!!
@naboulsikhalid7763
@naboulsikhalid7763 2 жыл бұрын
I don't understand why you are still under rated. Man, your things are high quality and quantity in term of info and demos. Thank you very much(it's not enough)
@gautampassi3863
@gautampassi3863 7 жыл бұрын
Can you continue this Arduino series? The way you present stuff is really interesting, fun and makes really easy to understand the stuff. PS great video.
@greatscottlab
@greatscottlab 7 жыл бұрын
It will continue if there are enough people who watch it.
@iMsMs
@iMsMs 7 жыл бұрын
There are! please keep them up
@gautampassi3863
@gautampassi3863 7 жыл бұрын
Yes there are and will be, just please keep the great work.
@empb50
@empb50 7 жыл бұрын
Gautam Passi agree 👌👌
@lexaf7578
@lexaf7578 7 жыл бұрын
yeah pls its rly nice to watch
@connormitchell9837
@connormitchell9837 2 жыл бұрын
These have been some of the best and most informative videos I've found on Arduino "basics." In tandem with your electronics basics videos, I've been able to connect my previous knowledge of basic electrical circuits with the more nuanced languages of programming. Thank you so much!
@asgaines
@asgaines 7 жыл бұрын
Fantastic! Somehow, despite having been playing around with Arduinos for years, I've never encountered interrupts! Great information, GreatScott
@harisijaz946
@harisijaz946 7 жыл бұрын
I used arduino uno before but now i am able to write small codes of my own . I love all your videos but arduino basic series is excellent. Keep it up and waiting for Arduino Basic 103 :-)
@Rckeeps
@Rckeeps 7 жыл бұрын
Holy crap! After 1.5 years of java, and 4 months with arduino, i was pretty comfortable with basic arduino programming, but I've never heard of Attached Interrupts! Wasn't even gonna watch this video, but decided to anyways. I learn something in every video of yours. Thank you so much!
@brucewoods9377
@brucewoods9377 7 жыл бұрын
GreatScott this is Great Stuff. I am new to Arduino (only a couple of days old) and your presentation makes it so EASY to understand. You don't get side tracked in your explanations and start running off with some complicated stuff. Love the way you use the "KISS" principal. I need it like that.
@tdtrecordsmusic
@tdtrecordsmusic 7 жыл бұрын
Thanks for keeping a good pace !! Also, for touching on the more advanced. There is soooo much beginner stuff its difficult to find tips/tricks/unknowns which end up being necessary for completing real projects !! Yes go farther !! We are smart, we can keep up !!
@ozgemmo3445
@ozgemmo3445 7 жыл бұрын
Mate, great arduino coding videos - looking forward to seeing 03! Not having done any formal "C" or other language coding whatsoever, you are helping to demystify this fundamental area of using Arduino based projects. Keep up the great work. Cheers from DownUnder.
@chillzwinter
@chillzwinter 7 жыл бұрын
I ordered my Arduino. Now I can't wait to get it so I can follow these tutorials.
@theZ3r0CooL
@theZ3r0CooL 7 жыл бұрын
Awesome videos! I like that you keep tutorials very beginner friendly; even explaining operators and array indexes as you go along, in a thorough yet quick and simple way. Very efficient and enjoyable videos.
@georgetroulis
@georgetroulis 7 жыл бұрын
Lots of information packed into a single video, excellent learning resource. As always, keep up the good work :)
@paulfaugeras4858
@paulfaugeras4858 7 жыл бұрын
Thank you SOO much for those tutorials ! I personally have started coding on Arduino about 6 months ago for a study project : a PID-controlled drone arm with a brushless motor and an accelerometer. If only I had those videos before, it would have been much easier... But now it works, and I learnt the hard way, which is, to my taste, more rewarding, but much slower... Anyways, thanks again, and I can't wait to see the future episodes !
@liutas1245
@liutas1245 7 жыл бұрын
Continue Arduino series !!! :))) You explain things better than anyone else that I know or than I saw on youtube :) Big thumbs up !
@poorlycalculated
@poorlycalculated 7 жыл бұрын
I really am appreciating this series! Thank you so much for making this series and giving me more things to learn about! I am a complete and utter noob at programming with arduino. Hopefully, you will progressively get to more complicated things in the world of coding and I will be able to learn from it! Keep up your good work.
@horrorhotel1999
@horrorhotel1999 7 жыл бұрын
i pretty much agree with everyone else : these videos are incredibly well made, and really bring across the content- obviously you nedd to get basic electronics in order to get them, but the way you explain the software end of things is really remarkeable - please continue this series, i could really see them becoming immensely popular if someone mentions them in the right reddit or so
@BluehawkOne
@BluehawkOne 7 жыл бұрын
This was very helpful. Please consider making a whole series of videos like this.
@aniketakabir1572
@aniketakabir1572 7 жыл бұрын
will be anticipating arduino 103. Keep up the good work
@luqmankhan-ym4gx
@luqmankhan-ym4gx 7 жыл бұрын
wow. hands down best electronic tutoriols on youtube. proud of you buddy. grüße aus frankfurt
@WayneMcNab
@WayneMcNab Жыл бұрын
As usual, your explanation is great! However, I did find it a bit fast to for just learning this subject. Keep up the great work
@raphael9485
@raphael9485 7 жыл бұрын
This series is really good, I'm learning a lot with it, thank you ! I love your channel!
@asadkhan7441
@asadkhan7441 7 жыл бұрын
I think this is the only diy electronics channel which is this awesome
@dylanwillms1275
@dylanwillms1275 7 жыл бұрын
The way you explain things is Great after folowing your channel for almost 1 year i learned a lot please keep uploading videos
@greatscottlab
@greatscottlab 7 жыл бұрын
Thanks for the feedback :-) I will try to keep it up
@dylanwillms1275
@dylanwillms1275 7 жыл бұрын
Nice !
@adigunawibi
@adigunawibi 7 жыл бұрын
i love this type of video, my teacher did not teach me quiet well.
@azyfloof
@azyfloof 7 жыл бұрын
Loving these Scott! Lots of great tips, keep em coming, they're valuable to people learning arduino such as myself :D
@stevemorse5052
@stevemorse5052 7 жыл бұрын
I have just watched Arduino 101. I have been using Arduinos for many years, love the platform. So as I watched your 101 video, I was surprised to find out something I did not know. Danke Schön (It was the value or, and how to use the internal pull up resistor) Now on to 102
@enduser6957
@enduser6957 7 жыл бұрын
I liked how you kept drilling in until a controller was required...Liked!
@ElProfeGarcia
@ElProfeGarcia 7 жыл бұрын
Bien explicado el video, saludos
@Dygear
@Dygear 5 жыл бұрын
That was a very concise explanation of interrupts.
@eddiejones8709
@eddiejones8709 2 жыл бұрын
Great videos' as always. I built your FM radio project for my grandson and he really likes it. I have been trying to add an EEPROM read and update function to this project to remember the last frequency selected (with a 5 min timed cycle). So that when the radio is switched on again it would use this frequency instead of the one pre-programed in the sketch. Thanks
@joseneves4273
@joseneves4273 7 жыл бұрын
Scott, this was the best video about this content I have seen!!! Thanks!
@brad855
@brad855 7 жыл бұрын
great video, makes me want to start playing around with my ardunio uno again, keep up the good work.
@Dogeek
@Dogeek 7 жыл бұрын
I love your arduino videos, they're so helpful if I don't remember how to do something. If you could add a menu at the beggining in the form of clickable annotations, that'd be awesome !
@stefanbramel
@stefanbramel 7 жыл бұрын
I already bought myself an Arduino to play around with it and it's great. :)
@Anonymous-qx5uk
@Anonymous-qx5uk 7 жыл бұрын
C++ Programing Basics with GreatScott , good one mate!
@can.iman.
@can.iman. 7 жыл бұрын
I really would like to see more arduino basics!!
@lenn8432
@lenn8432 7 жыл бұрын
Great video! You should definintely continue this series
@Richie_
@Richie_ 2 жыл бұрын
Great video, Great Scott.
@power-max
@power-max 7 жыл бұрын
Make sure to cover bit masking, direct port manipulation, bit shifting, pointers and stuff! These are advanced things that are hard to learn about without taking an embedded class!
@sallanmega1
@sallanmega1 7 жыл бұрын
Great video! Please continue this series, I love it
@Jajaho2
@Jajaho2 7 жыл бұрын
Knows all the stuff. Still watches the video, because Scott is awesome.
@FabiiFK94
@FabiiFK94 7 жыл бұрын
great Video :-) I had C Basics last year but you can bring all easy to a nutshell! How to set up a Interrupt at a Arduino is very intresting
@MaxCamacho
@MaxCamacho 7 жыл бұрын
Great Scott!! I have no clue what you are doing but it sure is fascinating!!
@PeteVanDemark
@PeteVanDemark 7 жыл бұрын
Excellent video. Thank you. Looking forward to Arduino Basics 103.
@bocmanisbertrups9292
@bocmanisbertrups9292 7 жыл бұрын
This video explained me alot of things about arduino! Awesome video! I'm already waiting for the next part! :)
@chbonnici
@chbonnici 7 жыл бұрын
Thank for the video . It would have been nice if you showed the full program. Where did you declare "m"
@rehaanahmed8694
@rehaanahmed8694 7 жыл бұрын
great tutorial ... great job greatscott...
@Khatrie169
@Khatrie169 4 жыл бұрын
really enjoyed your video's was hoping there was an arduino basics 103. wish you would of continued this!
@jimbobillybob1959
@jimbobillybob1959 7 жыл бұрын
Always learn something new. Great video series!
@fetchmarksthespot5309
@fetchmarksthespot5309 5 жыл бұрын
Do you have a video including an off line SMS message? I’m starting a house project and don’t want to use WiFi or Bluetooth instead an SMS that will work offline or online.
@topten7064
@topten7064 4 жыл бұрын
Your voice , information & you are great
@RishabhMutha
@RishabhMutha 7 жыл бұрын
wow! its much easier than I thought! thanks scott!
@FHBStudio
@FHBStudio 7 жыл бұрын
I'd like at least three more in this series. The one you mentioned, one as an introduction to sensors and working with sensor data and a last one, which discusses when to use an arduino or when to use alternatives. For example, I wanted a device to water my plants every 24 hours so I made a prototype with Arduino only to consider that the Arduino is too OP for such a simple function. Another project was to have a dimming LED strip light up over a settable time span at settable times. Again, Arduino prototype, end result: alarm clock + LED controller, without an Arduino. In the end, that last approach was soo much better than the Arduino, since it already included configuration components that I'd have to build from scratch on the Arduino.
@Emtron_Technologies
@Emtron_Technologies 7 жыл бұрын
Very Nice tutorial for beginners. Your putting much effort get the episode consistently with great content. And While statement is just a fancy for loop.
@FadiFadi00
@FadiFadi00 7 жыл бұрын
Great work, I already knew that but i enjoy watching your videos 😊 Waiting for your next video 😄
@jansinski6213
@jansinski6213 7 жыл бұрын
can you show how to conect simple lcd to arduino nano
@vishalchavda3663
@vishalchavda3663 7 жыл бұрын
Great Voice u have... and knowledge also...
@thomasrobin
@thomasrobin 7 жыл бұрын
Love your videos! Please make an advance arduino video series
@ravitdayal5774
@ravitdayal5774 7 жыл бұрын
Thank you sir I really liked the first video of this series and I love this one very helpful.do you use other microcontrollers.if yes can you teach about them too?
@josea.hernandezs.348
@josea.hernandezs.348 7 жыл бұрын
hi! as you i am engineer, but in telecommunication i enjoy your videos. you has nice ideas and curious experiment, i hope so can study a master in Germany some day :)
@MrBiky
@MrBiky 7 жыл бұрын
Well, I finally understand fully 1 of your videos (because I do programing a lot)
@thiagocamargoalima
@thiagocamargoalima 7 жыл бұрын
I did not know about the attachInterrupt function. thanks!!!
@JoshuaHeckathorn
@JoshuaHeckathorn 7 жыл бұрын
#icantprogramforshit SO - I will be referring to this pretty much every time I build with an Arduino, just like I've referred to many of your other videos, among other resources. The pace is quick, but you're quite concise and I almost always learn something so rewatching to pause and soak it all in is not the problem for me. Thanks!
@kencover2040
@kencover2040 7 жыл бұрын
NEED MORE VIDEOSSSS. But really, love your videos =D Very helpful for learning about the arduino.
@omkarbhatt2729
@omkarbhatt2729 7 жыл бұрын
Great Scott. I'm a big fan of your work. just wanted to know what oscilloscope do you use? and can you do a video on oscilloscopes and their different types.
@jamesmoon5632
@jamesmoon5632 Жыл бұрын
Great lesson!!
@deangreenhough3479
@deangreenhough3479 7 жыл бұрын
Still learned a lot, well presented and executed
@yashaswikulshreshtha1588
@yashaswikulshreshtha1588 3 жыл бұрын
I have been using Arduino's for quite a long time, and I have to say I absolutely love them, you don't have learn C in the first place you can get along with Arduino just fine you might have some problem with concepts but with it will never be complicated, with Arduino you'll start off with making programmed electronics project and I think this way is actually really good of developing knowledge of electronics and programming at the same time, it covers both domains. Also I think as you will learn more you'll see actual programming languages like python, C++, Arduino C and java generally consist of 1) Variables and advance Variables 2)Control structures 3)Interrupts they can contain a lot of things of could vary but they all consist of these at least, what makes you a good programmer isn't learning the concepts but to be able to develop concepts, as you'll advance through the journey from intermediate to advance you'll see now you have to learn programming techniques and algorithms, you'll start off with making few simple to intermediate level techniques after some time you'll realize what algorithm and techniques are all about and at that point you might be able to step into the further most step and that is probably expertise in this level you'll apply your knowledge in real world technology and developing algorithms, techniques for robots or anything to function. At that point you'll have such good knowledge of coding and concepts that it will be just like a language you speak or like basic maths, your focus will be more on actual functionality of the things, coding will be just like translating the entire expression to machine that's all, It can get tedious, programming hundreds and thousands of code will get you exhausted, but hey that will just fade away just in half and hour or couple hours and you'll love it after you'll return. At that point you might be interest in exploring a little bit more in this field and understanding not just algorithms and stuff but a lot more than that, with being good in robotics you can get better by combining your knowledge with learning new things like networking, webpage communication, TELNET shell commands, and trust me robotics and electronics is branch that covers literally all domains of technology like A.I, Machine learning, physics, Math's, Computer Science, programming, mechanics, electronics, electricals(sort of), Network and communication, chemistry, philosophy, Bionics, data science, data analysis, database management, application development, Nano technology. Although in the term robotics you can literally cover these all things as it incorporates use of everything but keep in mind that robotics is still isn't advanced as living physical biology and despite the fact they have their pros and cons, you may see all those domains as more like aspect or additionality to robotics however robotics in real world at least covers domains like, physics, Maths, CS, programming, mechanics and electronics as basic requirements. Those aspects range so much that they have their own separate fields and are separate subjects. I believe pursuing career in robotics will be more beneficial cuz you'll be exposed to many aspects and fields at once and how they interact with each other, having good foundation through those you'll be able to switch between careers in science and technology pretty easily such as if you're robotic programmer than you can be software engineer or application developer etc I don't say what I say is hundred percent accurate but I am just giving general idea. I hope if any beginner or someone who's interested in tech will find this helpful.
@shrikantnikam2426
@shrikantnikam2426 4 жыл бұрын
Is it possible to make millis function in separate tab and use millis single line command like delay? For make code more simpler
@jayzo
@jayzo 7 жыл бұрын
This is a really useful video. Does the Arduino handle overflows by itself or will you have to add code to deal with errors like it.
@yaminyassin3602
@yaminyassin3602 6 жыл бұрын
love your handwriting! :D
@ShaileshDagar
@ShaileshDagar 5 жыл бұрын
Great Video, would love to see Arduino Basics 103.
@k_8609
@k_8609 7 жыл бұрын
first video that made sense to me , Its very similar to C++
@Jono6671
@Jono6671 7 жыл бұрын
you are a legend bro, keep up the hard work!!
@uNabL3
@uNabL3 7 жыл бұрын
Arduino is nice, but how about comparing it to other uCs on the market? Benefits, pros/cons, and when you should consider one or another for a particular application type?
@NuclearDesert
@NuclearDesert 7 жыл бұрын
Is is possible to make some sorta radio that can play online music streams and function as a alarm clock?
@MrCrystan
@MrCrystan 7 жыл бұрын
Thank you. This is the kind of explanation i was needed to crack the functions down. Still, can you go a little deeper on that "Case" function. tnx
@Fabian-mu3hq
@Fabian-mu3hq 7 жыл бұрын
can you make a dc to ac inverter? one cheap and one wich works like a bough one?
@fibranijevidra
@fibranijevidra 5 жыл бұрын
Well presented. Keep on with tutorials.
@atscub
@atscub 6 жыл бұрын
Great video !!
@ddsdispbos1155
@ddsdispbos1155 7 жыл бұрын
Thank you very much. Great video
@BrownBearNinja
@BrownBearNinja 7 жыл бұрын
at 4:31 you describe how within the [ ] the values start at 0 for the first pin, where 2 would equal 3 pins, but in your code you have pin [3]. Would this not be a fourth pin? Got me confused.
@youraveragenerd9101
@youraveragenerd9101 7 жыл бұрын
Great video for beginners :D
@AlanDike
@AlanDike 2 жыл бұрын
you have just made my f'ing day! that && is EXACTLY what I wasn't sure it could do.. I was nesting if (true) { if (true) { blah } else { blah2} } That && works the same way I'm used to working in powershell and this is exactly what I need. i think you just cut my code in half!
@JVG_2009
@JVG_2009 Жыл бұрын
Thank you for amazing information about Arduino programming 👍
@mohamedhamzakermia2551
@mohamedhamzakermia2551 7 жыл бұрын
HELLO Is it possible to make a video how to change the arduino frequency with a PWM with the interreption.
@MikesDIYTeslaPowerwall
@MikesDIYTeslaPowerwall 7 жыл бұрын
Thanks for yet another great video, This helps alot.
@UsePINpadtoCompleteTransaction
@UsePINpadtoCompleteTransaction 7 жыл бұрын
YES *in a bigger font than allowed* Thank you!!
@RoamingAdhocrat
@RoamingAdhocrat 4 жыл бұрын
If you're keeping pin numbers in an array, 1: use an enum to name the index values 2: use `for( auto p : pins)` to get the pin values
@SIKHGT650
@SIKHGT650 6 жыл бұрын
hiii,,, how to play clicker games like stacks and egg buster with arduino (controlling capacitive touch screen with arduino) can anyone advice cammands or programs for them..thanx
@ferdinandp21
@ferdinandp21 7 жыл бұрын
thanks man what was really cool. do you have any adruino drones videos?
@avijitsengupta3819
@avijitsengupta3819 Жыл бұрын
It's great, would you plz guide me to build one project with 8 pushbutton & 8 leds instead of 3, with latched function!! If any one of those button is pressed the led assigned with it will glow in latched state till the button pressed again. While the led is glowing then any other switch will be inert,will you plz guide me Sir?
@joziee131
@joziee131 7 жыл бұрын
What code do you use to program this?
@owlsight4499
@owlsight4499 7 жыл бұрын
0:57 - it supposed to be "less than or equal TO" and "greater than or equal TO" Nonetheless; very good job and thanks for another episode!
@ikehsamuelifeanyi4925
@ikehsamuelifeanyi4925 Жыл бұрын
FTDI arduino nano has refused to be driven by the drivers I found on the internet. I have tried everything thing but the Nano was unable to upload my codes. Which other way can I make the Nano work for me or recommended driver site. I am desperate! Thank you
@MonsieurMammouth
@MonsieurMammouth 7 жыл бұрын
Hi! What's the brand of your breadboard? I've just bought two different ones, and they are just horrible... Do you recommand anything?
@asadkhan7441
@asadkhan7441 7 жыл бұрын
keep it up scott.
Understanding Arduino Interrupts | Hardware, Pin Change & Timer Interrupts
48:17
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 5 МЛН
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 17 МЛН
마시멜로우로 체감되는 요즘 물가
00:20
진영민yeongmin
Рет қаралды 31 МЛН
I tried finding Hidden Gems on AliExpress AGAIN! (Part 9)
15:00
GreatScott!
Рет қаралды 941 М.
Arduino Sketch with millis() instead of delay()
14:27
Programming Electronics Academy
Рет қаралды 225 М.
Arduino Basics 101: Hardware Overview, Fundamental Code Commands
8:02
Level Up Your Arduino Code: External Interrupts
18:55
SparkFun Electronics
Рет қаралды 172 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
From Idea to Schematic to PCB - How to do it easily!
11:05
GreatScott!
Рет қаралды 1,8 МЛН
Arduino Programming Syntax
9:15
SparkFun Electronics
Рет қаралды 238 М.
How to Control a 12V Motor with Arduino: Easy Wiring & Code Examples
44:13
DIY sonar scanner (practical experiments)
14:30
bitluni
Рет қаралды 1 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 415 М.
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 1,3 МЛН
Здесь упор в процессор
18:02
Рома, Просто Рома
Рет қаралды 379 М.
Top 50 Amazon Prime Day 2024 Deals 🤑 (Updated Hourly!!)
12:37
The Deal Guy
Рет қаралды 1,4 МЛН
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 669 М.
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 12 МЛН