Tutorial 12: For Loop Iteration: Arduino Course for Absolute Beginners (ReM)

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 มิ.ย. 2024
  • 🤩 How much Arduino can you learn in 7 Days? 👇
    bit.ly/7_Day_Arduino_Challenge
    **If you like this, I think you'll like the premium Arduino training we offer. Check it out here** bit.ly/3nSBPUs
    We designed this circuit board for beginners!
    Kit-On-A-Shield: amzn.to/3lfWClU
    SHOP OUR FAVORITE STUFF! (affiliate links)
    ---------------------------------------------------
    We use Rev Captions for our subtitles
    bit.ly/39trLeB
    Arduino UNO R3:
    Amazon: amzn.to/37eP4ra
    Newegg: bit.ly/3fahas8
    Budget Arduino Kits:
    Amazon:amzn.to/3C0VqsH
    Newegg:bit.ly/3j4tISX
    Multimeter Options:
    Amazon: amzn.to/3rRo3E0
    Newegg: bit.ly/3rJoekA
    Helping Hands:
    Amazon: amzn.to/3C8IYXZ
    Newegg: bit.ly/3fb03X1
    Soldering Stations:
    Amazon: amzn.to/2VawmP4
    Newegg: bit.ly/3BZ6oio
    AFFILIATES & REFERRALS
    ---------------------------------------------------
    ►Audible Plus Free trial: amzn.to/3j5IGrV
    ►Join Honey- Save Money bit.ly/3xmj7rH
    ►Download Glasswire for Free:bit.ly/3iv1fql
    FOLLOW US ELSEWHERE
    ---------------------------------------------------
    Facebook: / programmingelectronics...
    Twitter: / progelecacademy
    Website: www.programmingelectronics.com/
    Click Below to Read About This Topic on Our Website
    programmingelectronics.com/tu...
    Description:
    Arduino Course for Absolute Beginners
    There are few functions so useful that you find them everywhere. The 'for loop' is an example of this type. A For Loop repeats an action for a specified number of iterations, reducing the lines of code that need to be written thus making the programmers life easier.
    In this example we are setting out to make a row of LEDs light up somewhat similar to Kit in Knight Rider.
    You Will Need
    LED (6)
    220 Ohm Resistor (6)
    Solder-less Breadboard
    Jumper Wires (1)
    Red Canary (42)
    Step-by-Step Instructions
    Connect one side of a resistor into pin 2, connect the other side into a row on the breadboard.
    From that row in the breadboard where you attached the resistor, connect the long leg of the LED.
    Connect the short leg of the LED to one of the power strip columns on your breadboard.
    Now connect a resistor to pin 3, and put the other leg in a row on the breadboard (a different one then your first LED.
    Connect an LED in the same manor - make sure the short leg goes in the SAME power strip column as the previous LED.
    Repeat this through pin 7.
    Using a jumper wire, connect the common power strip to a GND pin on the Arduino.
    Connect the Arduino to your computer.
    Open up the Arduino IED.
    Go to File, Examples, 05.Control, ForLoopIteration
    Click the Verify button (Top Left). The button will turn orange and then blue once finished.
    Click the Upload button. The button will turn orange and then blue when finished.
    Watch in awe as your LEDs turn on and off in sequence.
    The first executable code we find is the declaration of the 'timer' variable...
    int timer = 100; // The higher the number, the slower the timing.
    This integer variable with a descriptive name will set the rate between one LED turning on and off. What is so important about variables like these is how easy they allow you to alter your code and how your circuit will run. If the programmer had written the number 100 in a bunch of functions through out this program we would have had the exact same effect, but as soon as we want to speed up the blinking of the LEDs, now we have to go through and change every 100 to a 500 - what a pain - especially when you miss a couple 100's, and accidentally put a 500 where there shouldn't have bee one. These variables are like controls into your program - imagine you are on the Star Ship Enterprise, all those buttons and touch screen levers - these are your control variables.
    Our next friendly block of code is setup(). In this setup() function we run into our first For Loop.
    void setup() {
    for (int thisPin = 2; thisPin LT 8; thisPin++) {
    pinMode(thisPin, OUTPUT);
    }
    }
    Let's consider just what is inside the parenthesis following the for loop..
    for (int thisPin = 2; thisPin lt 8; thisPin++)
    There are three separate statements in the parenthesis separated by a semicolon. The first statement is initialization of the counter variable used in the 'for loop' and it looks like any other variable declaration and initialization that you have seen.
    int thisPin = 2;
    The 'thisPin' variable is what will be used in the next block of code - or the test.
    thisPin lt 8;
    This is the test condition that will tell the loop to keep going or to stop. If this condition is TRUE, the code in the curly brackets of the 'for loop; will be executed again, if the condition is FALSE, the
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 264

  • @programmingelectronics
    @programmingelectronics  3 ปีที่แล้ว +4

    ****If you like this, I think you'll like the premium Arduino training we offer. You can check it out here**** bit.ly/3lHyzcB

  • @adriansofa
    @adriansofa 7 ปีที่แล้ว +1

    I'm from México, I'm in the fourth semester of mechatronis. I started the course and watching your video tutorials had encouraged me to bigger project on my own. Thank you for your patient and for all the info that you give us. I hope you read this comment and keep giving us a lot more of your knowledge :) Have a good day, and NeverEver Stop learning

  • @GonnaBeJumper
    @GonnaBeJumper 6 ปีที่แล้ว +17

    Like everyone else, I am more than grateful for your hardwork making these tutorials!

  • @44mod
    @44mod 6 ปีที่แล้ว +5

    I always loved that show Knight Rider and the car with the eye going back and forth scanning everything, it was so awesome. I am 53 years old and I guess you can teach a old dog new tricks. Thank you for taking the time to do the videos. You are a gifted teacher. Do not give up your teaching! The last thing i want to say is, I saw on the introduction page to your free classes that you are a veteran. I want to thank you for your service to our country and God bless you. Again thank you for taking the time to do these videos.

  • @spacewalker3519
    @spacewalker3519 4 ปีที่แล้ว +4

    Been watching all these, following along, doing the challenges at the
    end. Great work explaining this statement. I didn't have enough leds for
    this one so i used a 7 segment display...only problem was it's common
    anode. I used +5 for the common and exchanged all the HIGH's and LOW's in the
    digitalWrite arguments, with their complements...then added the 2 leds for the
    challenge at the end....everything worked out aok. This has been a great series. Thanks.

  • @pikubird
    @pikubird 9 ปีที่แล้ว +38

    woow. I cant believe the HUGE and AWESOME WORK you have done on this tutorials my friend.
    I dont think words could express my gratitude.
    GOD BLESS YOU

    • @programmingelectronics
      @programmingelectronics  9 ปีที่แล้ว +3

      Thanks!

    • @yashaswikulshreshtha1588
      @yashaswikulshreshtha1588 4 ปีที่แล้ว

      @@programmingelectronics You're a genius you just did greatest explanation that i can never have. But still how do i use FOR loop in my daily projects like very frequently like loop for eg, IF and ELSE IF and else. I still don't understand the format of it completely. Although your tutorial was one of the greatest. I tried to understand but i was
      slamming my head. Now i won't slam my head on walls anymore. BUT HELP ME PLEASE WITH THAT QUESTION

    • @joaosimoessilva
      @joaosimoessilva 4 ปีที่แล้ว

      @@yashaswikulshreshtha1588 didn't understood your question

    • @yashaswikulshreshtha1588
      @yashaswikulshreshtha1588 4 ปีที่แล้ว

      @@joaosimoessilva Actually in this video he explained the working of code, which was essential to understand the working of FOR loop, But my question is what does FOR exactly mean in programming, you can do the same things with other loops too like IF, ELSE IF and WHILE, so what's the difference between these all, regardless of how long code can be. Like we know that what exactly IF loop means, we truly know the meaning of "IF" in arduino, likewise what is the meaning of FOR loop. I know it's format, but i want to know what is the true meaning of FOR loop, what does it specify, which other loop can't specify, what is the specific meaning of FOR loop, and what is specific functioning in arduino except that it can make the code shorter. I mean there must be some kind of use in it for FOR, for some specific functioning. My problem is that i don't have specific advantage or use, from which i can differentiate between these loop in my mind so that i can understand these loops easily, and use it accordingly. CAN YOU PLEASE HELP ME THIS?

    • @joaosimoessilva
      @joaosimoessilva 4 ปีที่แล้ว

      @@yashaswikulshreshtha1588 You are probably having all this question on your mind because you are learning Arduino. And Arduino works with this setup / loop method. But if you program in other languages, chances are that you won't use this system. Basically what it means is that your code in other languages will only run once, and not in a loop. For that reason, if you want to run sections of your code multiple times, you have to use repetition structures (that consist mainly on FOR and WHILE). For is normally used when you know how many times you want your code to run, while the while function is used when you are not certain of how many times do you want the code to run. To sum it up, you can't see the use of FOR in Arduino because it already uses a function to repeat the code. However, it can still be very practical to set the boundaries of the repetition (how many times or in what condition do you want the code to be run repeatedly). Hope it was helpful. Any doubt, feel free to say it

  • @varunvenkats3418
    @varunvenkats3418 7 ปีที่แล้ว +2

    Now a pro with Arduino, all the credits comes to your massive efforts u hv put in these tutorials.
    thanks a lot!
    And do make a lot more project videos on these.

  • @JeanneduPlessis
    @JeanneduPlessis 7 ปีที่แล้ว +1

    These tutorials are awesome. I'm learning ten times faster than I would have on my own and I'm having a blast. Thank you so much!!

  • @krallopian
    @krallopian 7 ปีที่แล้ว +1

    Jeeeeez, this is the first time I understood FOR loops. I am SO glad I found your videos!!

  • @manoelfelipe1807
    @manoelfelipe1807 5 ปีที่แล้ว +4

    Man, you're great! You explain each piece of code and you do this so well. Thanks for all!

  • @cameronallan5624
    @cameronallan5624 5 ปีที่แล้ว +3

    keep doing what you do. I went from not knowing what Arduino is to making my own code (all be it simple one) in a day. best thing about you is that your explanations are not rushed and you refer back to previous videos to get syntax rooted in our memories.

    • @yashaswikulshreshtha1588
      @yashaswikulshreshtha1588 4 ปีที่แล้ว

      Exactly, he's the one for whom we were awaiting, being honest he'd make us from noobs to masters

  • @cptgerard
    @cptgerard 6 ปีที่แล้ว +1

    I only had three led's in my kit, so I adjusted the sketch. You're a great teacher. Thanks!

  • @user-rg7gg2vx7b
    @user-rg7gg2vx7b 5 ปีที่แล้ว +3

    Really thankful for your videos. You are an educator, be proud!

  • @TheeSlickShady
    @TheeSlickShady 8 ปีที่แล้ว +1

    I absolutely love this series!
    It has helped me understand some fundamental Arduino concepts and for that I say thank you! You clearly have an innate understanding of these things to explain them so well and the blend of humour and graphics make these videos enjoyable to watch.

  • @thisissoeasy
    @thisissoeasy 9 ปีที่แล้ว +2

    Brilliant! Thank you so much for this (and all the other) tutorial(s)!

  • @orlandowall5523
    @orlandowall5523 2 หลายเดือนก่อน +1

    Best Arduino tutorials on YT!!!!

  • @thomasrogers2
    @thomasrogers2 7 ปีที่แล้ว +5

    i get so excited when i hear that intro music :)

  • @andrewainger
    @andrewainger 6 ปีที่แล้ว

    GREAT tutorial!Love the Record analogy too! Many thanks - and so patient.

  • @therealprince777
    @therealprince777 6 ปีที่แล้ว +1

    I've learning to code and this is the best explanation of the for loop. thank you.

  • @skeleton-man
    @skeleton-man 8 ปีที่แล้ว +27

    These videos rock. Big fan! Thanks for all your work. Truly appreciated :o)

    • @programmingelectronics
      @programmingelectronics  8 ปีที่แล้ว +5

      +SkeletonMan Thanks a ton for watching!

    • @yashaswikulshreshtha1588
      @yashaswikulshreshtha1588 4 ปีที่แล้ว

      @@programmingelectronics Hey, how are you? Your videos are just insane, you just opens the mind from the prison of improper definitions of any one else. your explanations were so much better than any one else

  • @ThierryC2373
    @ThierryC2373 4 ปีที่แล้ว

    This is by far the easiest and clearer explanation about a for loop. I wish you made "for i=" programmation explanation!!!

  • @pythonbytes781
    @pythonbytes781 7 ปีที่แล้ว

    Looks like I'm moving on from Python to Arduino C. Great videos. Easy to understand and grasp the concepts. Thank you.

  • @zulfiqarchaudhary8392
    @zulfiqarchaudhary8392 7 ปีที่แล้ว

    Hey Man thank you very very much for the tutorial i was completely new to arduino but now i understand every statement , loops and the syntex of the language. Thank you :)

  • @mbs7969
    @mbs7969 3 ปีที่แล้ว +1

    Thanks to this tutorial I finally understood "for" loop. Great job.

  • @latikesh9386
    @latikesh9386 7 ปีที่แล้ว +1

    Best video, couldn't find any other video in comparison to all your videos. Sir please upload more videos . Waiting for your videos since many months

  • @JerryEricsson
    @JerryEricsson 8 ปีที่แล้ว +1

    Hi, just found this series, and it is very helpful. I have been playing with arduinos for over a year now and my collection of them is ever growing. That said, I used to be a BASIC programmer back in the 80's and 90's so I know some programming and even sold some basic stuff back then but this is a bit different. While the For-Next differs a lot, it is made very clear in this video - Thanks a million, it looks like I can now do more then copy other's code and modify it for my purposes!

    • @programmingelectronics
      @programmingelectronics  8 ปีที่แล้ว

      Glad it could help Jerry, thanks for watching!

    • @samflanagan77
      @samflanagan77 7 ปีที่แล้ว

      Same here Jerry, programming at a community college back in the day.
      C++ was just being introduced then. It's almost exclusively C++ now. C++ is much more sophisticated than BASIC. But CPU size has grown considerably from 8 bytes to now 64 bytes.
      It's all the same after a high level language is compiled. If you have any spare time any Freshman level C or C++ programming class will get you up to speed.

  • @MrDhanesh2nair
    @MrDhanesh2nair 8 ปีที่แล้ว

    Bro I am from India . My gratitude from the deepest part of my heart.

  • @adrianacuna1594
    @adrianacuna1594 6 ปีที่แล้ว +1

    best explanation i´ve found, thanks a lot man!

  • @codewithcc
    @codewithcc 4 ปีที่แล้ว +1

    You perfectly demonstrate everything

  • @guillermoisidoro4060
    @guillermoisidoro4060 7 ปีที่แล้ว

    Man! you're the best teacher....congratulations....!!!

  • @Felisargyle
    @Felisargyle 5 ปีที่แล้ว +4

    I am a noob this helped me so much understand code i found from someone else thank you so much.

  • @edoardopona8512
    @edoardopona8512 9 ปีที่แล้ว +1

    a challenge i'll be trying: The same thing of this for loop, but with the LEDs fading in and out, not just blinking!!
    Great tutorials!! Thanks a lot!

  • @krishnankv7894
    @krishnankv7894 5 ปีที่แล้ว +1

    sir...u r awesome..ur explanations makeing everything seems easy to follow..
    finally i found a good tutorial for arduino...
    grt wrk sir..

  • @carlopaiocchi1622
    @carlopaiocchi1622 7 ปีที่แล้ว +1

    very well done!big up bro!

  • @ricardrinaldo4791
    @ricardrinaldo4791 6 ปีที่แล้ว +1

    Another great tutorial 👍🏻👍🏻👍🏻

  • @catchulater7483
    @catchulater7483 ปีที่แล้ว +1

    The way you explain… makes it possible for me to participate even though I’m cixelsyd/dyslexic.
    Thanks man

  • @REVOLSAMI
    @REVOLSAMI 5 ปีที่แล้ว +1

    You deserve a gold medal

  • @f.a3202
    @f.a3202 5 ปีที่แล้ว

    omg!! the for loop was the most difficult for me. It was but it's not anymore thanks to you

  • @TheVersionController
    @TheVersionController 10 ปีที่แล้ว

    Your videos are unbelievably helpful and well done. Cheers.

    • @programmingelectronics
      @programmingelectronics  10 ปีที่แล้ว +1

      I am glad they helped! Let me know what I should improve upon.

  • @Ashley-xz5sd
    @Ashley-xz5sd 4 ปีที่แล้ว +1

    thank youuuu so much I had to do a project for this code and I was so lost for a day until I found this video thank you so much

  • @damonsisk4270
    @damonsisk4270 4 ปีที่แล้ว +1

    Your videos are all wonderfully laid-back and clear; this video included. Just one suggestion if you ever decide to remake it: instead of incorporating the variable declaration and increment inside the parameters of the for loop, declare and initialize the variable before the for loop, and include the increment just before the end curly bracket. Then you could show the full 'thisPin = thisPin + 1;' explain thisPin++, and the compact way of incorporating it all into the for loop. Thank you for all your work!!

  • @remyholt9260
    @remyholt9260 8 ปีที่แล้ว

    absolutely love all of these tutorials thanks lot.
    and the things that you say you need but don't actually need at all trick me every time!
    (not that i actually got them or anything)

    • @programmingelectronics
      @programmingelectronics  8 ปีที่แล้ว

      Thanks for the kinds words. i do my best to try to keep them fun (even if it is lame fun).

  • @dermotupton4341
    @dermotupton4341 7 ปีที่แล้ว +1

    excellent turorials , i have the bug now and want to know more!!!!

  • @mother-fng-bonswa3612
    @mother-fng-bonswa3612 6 ปีที่แล้ว +1

    well , glad i am a vinyl dj for many years .. :D thanks ! !

  • @fretlord4201
    @fretlord4201 9 ปีที่แล้ว +3

    lol! I love the little "are you paying attention" statements..

    • @programmingelectronics
      @programmingelectronics  9 ปีที่แล้ว +3

      Mike Young I know I fall to sleep when i am watching technical stuff...Thanks for the comment!

  • @tonybeach4725
    @tonybeach4725 7 ปีที่แล้ว

    Done and dusted.. and challenges completed. Thank you.

  • @michaelpadovani9566
    @michaelpadovani9566 7 ปีที่แล้ว

    Thank you very much for these videos. So (if I'm understanding this correctly), embedded within a "For" command is a loop...that is independent of the "void loop" command. That's pretty cool.

  • @technovan1133
    @technovan1133 5 ปีที่แล้ว +4

    omg my brain is swimming i think i need watch it a few times

  • @valentinoamato9238
    @valentinoamato9238 5 ปีที่แล้ว +1

    Heey man so thanks for doing this tutorial
    You make something impossible to understand for me to the simpler analogy in the world
    SO THANKS

  • @PaulR387
    @PaulR387 3 ปีที่แล้ว

    Well done in explaining a complicated topic

  • @jbpaanakker
    @jbpaanakker 10 ปีที่แล้ว

    Great videos
    I especially like the way how you explain it...Thanks!

    • @programmingelectronics
      @programmingelectronics  10 ปีที่แล้ว +1

      Great - glad you like them Let me know if there are other tutorials you would like to see. Also, are you bare-foot skiing in that photo? Looks fun.

    • @jbpaanakker
      @jbpaanakker 10 ปีที่แล้ว

      No ,that was on a wakeboard.
      Thanks again.

  • @NifT59
    @NifT59 6 ปีที่แล้ว +1

    You are a born teacher

  • @stevenalbright3363
    @stevenalbright3363 8 ปีที่แล้ว

    Would it be possible to get the pins to do different applications with this code like run a servo code and blink or some of the other example codes simultaneously? And thanks for the videos there helping me alot and I am finally starting to get it through your vids.

  • @staz5591
    @staz5591 8 ปีที่แล้ว

    Thanks for the video.

  • @frickinbill
    @frickinbill 8 ปีที่แล้ว

    Wonderful tutorial series! You explain programming in a clear and easy to understand manner. I do have a question tho: Why not just have the Anodes of the LED's plugged into the Arduino pin slots and the cathode ends to a single power rail on the breadboard and have a single resistor from that same power rail to the Arduino ground? Since each LED is lit individually the resistor should be able to handle the load placed upon it. This would would also greatly reduce the amount of components.

  • @sudarapremathilaka1706
    @sudarapremathilaka1706 4 ปีที่แล้ว +1

    Great video tutorials about Arduino.Thank u so much. Keep it up.

  • @clarencecherrone7914
    @clarencecherrone7914 6 ปีที่แล้ว

    Good video. What causes the for loop to "trigger"? Is it the change in the state of (thispin)?

  • @mikesimmonds1916
    @mikesimmonds1916 7 ปีที่แล้ว

    Clear for something which in itself isn't. Thanks. How would you flash each LED for a certain number of flashes before moving on to the next LED?

  • @awesomethings3489
    @awesomethings3489 5 ปีที่แล้ว +1

    Pls do more of these tutorials...

  • @kabirwolly4309
    @kabirwolly4309 8 ปีที่แล้ว +1

    This is just grear. Nice work

  • @himathipalawatta5790
    @himathipalawatta5790 7 ปีที่แล้ว +1

    My thanks for u . I am learning this to programme a robot. I hope I will succeed

  • @miklok1833
    @miklok1833 8 ปีที่แล้ว

    brilliant videos.. any tutorial on how to operate a multi relay shield from digital inputs

  • @panda192012
    @panda192012 8 ปีที่แล้ว +1

    You are my hero! Thanks!

  • @mohamedghida9540
    @mohamedghida9540 2 ปีที่แล้ว +1

    wow , that was easy !!!.........really you are a master

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว +1

      Thanks so much for watching! I am more of a hobbyist than anything :)

  • @gapadad2
    @gapadad2 7 ปีที่แล้ว +1

    Very good videos. Thanks

  • @saludares888
    @saludares888 7 ปีที่แล้ว +1

    nice videos..well done

  • @raedamine2886
    @raedamine2886 8 ปีที่แล้ว

    hahhaha I was wondering why do you use the mouse at the end? Does it serve any purpose or just for fun? besides in the previous video, the hammer ... thank you for these great videos.

  • @snaprollinpitts
    @snaprollinpitts 10 ปีที่แล้ว +2

    you didn't say what to do with my chicken?! LOL
    oh, and just call me Doogie. Great video, excellent explanation
    you are Da arduino teachin guy!!! thanks so much mike

  • @HaloWolf102
    @HaloWolf102 7 ปีที่แล้ว

    One Question. The second loop that counters down. Why is it not included in void setup?

  • @RaulBillieJean
    @RaulBillieJean 10 ปีที่แล้ว +1

    thanks a lot for this !!

  • @eamonn280958
    @eamonn280958 9 ปีที่แล้ว +1

    Hi. Excellent tutorial series.
    I assume once you upload the sketch you can disconnect the Arduino from your computer and the programme runs.
    I want to produce a gadget for sale that the arduino could be programmed for, would you use arduinos' in the gadget or is it just for testing.

    • @programmingelectronics
      @programmingelectronics  9 ปีที่แล้ว

      Great question! I think most people would use Arduino for development and prototyping purposes. The final gadget would then have the microcontroller the Arduino uses embedded in it. You might be interested in this:
      arduino.cc/en/ArduinoAtHeart/HomePage
      Best of luck!

  • @h2o40fpv
    @h2o40fpv ปีที่แล้ว +1

    Thank u for this video.

  • @marianaurel
    @marianaurel 4 ปีที่แล้ว

    How come we don't use the Serial.begin here? Is that usually set by default in arduino (just like pins are usually set by default to be inputs?)

  • @WesleyRTech
    @WesleyRTech 7 ปีที่แล้ว +1

    What was the crystal mouse for?

  • @peterthinks
    @peterthinks 5 ปีที่แล้ว

    // loop from the highest pin to the lowest:
    for (int thisPin = 6; thisPin >= 3; thisPin--) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(thisPin, LOW);
    }
    Doing this to the second for statement makes it more bouncy.

  • @kingRenos
    @kingRenos 7 ปีที่แล้ว +1

    Awesome!!

  • @chrishandharmabandu4719
    @chrishandharmabandu4719 7 ปีที่แล้ว +1

    Glad I had the mouse figurine.

  • @yutrenovation5045
    @yutrenovation5045 7 ปีที่แล้ว +1

    Thanks..For Very good videos ^_^

  • @MyBigThing2010
    @MyBigThing2010 7 ปีที่แล้ว

    how do you get rid of the visible pause at the start and end of the blink sequence?

  • @guangyizhu5232
    @guangyizhu5232 5 ปีที่แล้ว

    just a beginner here, question please: you jump out of the for loop with an 8 and shouldn't it be carried onto the initial of the void loop?

  • @kobuspool3392
    @kobuspool3392 2 ปีที่แล้ว

    Why did the for code need to be entered in setup. Should it not work if it is only in loop?

  • @CristianSantellan
    @CristianSantellan 10 ปีที่แล้ว

    Great Videos dude!, Im glad I didn't look for the small crystal figurine! Jaja!

    • @programmingelectronics
      @programmingelectronics  10 ปีที่แล้ว

      Glad it was helpful - let me know of there are other tutorials on Arduino you would like to see.

  • @wick3de
    @wick3de 8 ปีที่แล้ว +3

    hey you guys are amazing! the arduino book its self doesn't explain shit :)

  • @wadisanaa
    @wadisanaa 8 ปีที่แล้ว +1

    do the resistors have to be exactly 220 ohms or would 330 ohms should work as well. And thanks for the great videos....i have done the first 11 tutorials ....i didnt even think i would do the first three tutorials . Thanks

    • @programmingelectronics
      @programmingelectronics  8 ปีที่แล้ว +1

      +wadi gaji I think the 330 would work just fine.

    • @E-BikingAdventures
      @E-BikingAdventures 8 ปีที่แล้ว +2

      +wadi gaji - These 5mm LEDs are designed to run off of 20mA of current. A 220 ohm resistor willgive you 13.6 mA. ((5 volts - foward bias voltage of red LED(2 volts)) / 220 = 0.0136. You can use a 150 ohm resistor to get full brightness. 3/150=20mA. A white LED has ~ a 3.5 Volt foward bias voltage, so the voltage across the resister will be 1.5 volts so; 1.5vollts/75ohms = .02 or 20mA. A 75 ohm resister for a white LED for full brightness. Using a higher value just means it wont be as bright. Just subtract the foward bias voltage from the supply voltage and divided it by .02 (20mA) resistance = Voltage/current.

  • @upasanasapra
    @upasanasapra 8 ปีที่แล้ว

    very well explained..

  • @sabrinawhite2482
    @sabrinawhite2482 8 ปีที่แล้ว +1

    the mouse was a nice touch

  • @tinybean4720
    @tinybean4720 3 ปีที่แล้ว

    I only have a crystal bear though, would that work? :(
    Jokes aside, I really love your videos! I've always thought of arduino as this thing which only electrical engineers could understand, but so far everything you've presented has been really easy to understand! Thanks for this course :D

  • @kodexe3298
    @kodexe3298 4 ปีที่แล้ว +1

    Can u pls tell me why did the programme have the 'for' loop in the Void Setup ??

    • @mbs7969
      @mbs7969 3 ปีที่แล้ว

      This loop set pins 2 to 8 as outputs.

  • @piyugkumar
    @piyugkumar 5 ปีที่แล้ว +1

    you're awesome!!!!!!!!!!!!!!!

  • @vege4013
    @vege4013 10 ปีที่แล้ว

    thanks greatly helpful. I have a problem downloading this tutorial(12).the only thing downloaded is the comercial.Any hint.
    Any hard copy books coming?
    Thanks

    • @programmingelectronics
      @programmingelectronics  10 ปีที่แล้ว

      Hi Veg E - Glad you find the videos helpful. TH-cam vids are not made for downloads last time I checked. If you visit the website [opensourcehardwaregroup.com/premium], you can buy the book there - though no hard copies yet...Maybe the end of this year? Best of luck!

  • @ricardrinaldo4791
    @ricardrinaldo4791 2 ปีที่แล้ว

    why not declare "int thisPin = 2" in the beginning?
    is there a benefit of doing it like in the video?

  • @FrankLopezx
    @FrankLopezx 9 ปีที่แล้ว +1

    hi great tutorial so far BUT im confused as to why the for loop is running from the void setup section rather than the void loop section?>

    • @programmingelectronics
      @programmingelectronics  9 ปีที่แล้ว

      Great question!
      As you may recall, the setup() section only runs once. We normally put all the code in the setup that we only care to have execute one time - the setup stuff, like pinMode(), serial.begin(), or other things that usually only need called once in the program.
      Since the for loop you are referring to is calling the pinMode function, it makes sense to put it in the setup(), otherwise, it would get called over and over again in the main loop() - because the main loop repeats continuously.
      Hope that makes some sense.

    • @FrankLopezx
      @FrankLopezx 9 ปีที่แล้ว

      Open Source Hardware Group yes i understand now the reason i just missed the oat when you made that clear, i thought it was a messup that's all, now as far as the headers why am i not seeing any headers bring used our called at the beginning like #include what ever library?
      Also i noticed setup and loop but not the main and i thought the order was main setup and loop?

    • @FrankLopezx
      @FrankLopezx 9 ปีที่แล้ว

      so whats up with the not using headers file? or using the attach syntax?

  • @anlaz1
    @anlaz1 5 ปีที่แล้ว

    Hello, help to solve this problem: There is a need for the Arduino platform on the command (external button - for example) to turn on the stepper motor.
    After performing the specified number of revolutions (1000), stop it and turn on the second stepper motor with a similar task (say 2000 revolutions)and stop.
    After receiving the second command, the program runs everything in reverse order.
    First the second motor 2000 rpm in the reverse direction, then the first 1000 revolutions in the opposite direction.
    Need a sketch of the program, if possible with detailed comments, as your humble servant is a kettle in programming
    With respect and hope.

  • @mickolesmana5899
    @mickolesmana5899 8 ปีที่แล้ว

    for loop is power, I love power

  • @heyho1202
    @heyho1202 5 ปีที่แล้ว

    Hello, quick question: i dont get the for loop in the void setup, the void setup starts only one time if you upload the program to the arduino. So doesn't it mean that the value of "thispin" ends with 7 then the program jumps to the void loop and executes his functions, so would'nt only the 7 Pin an Output und only the 7 LED would light up?

    • @claytonbinns7679
      @claytonbinns7679 5 ปีที่แล้ว +1

      No because all it's doing in the void setup is setting those pins as outputs. there is not another statement to set them back to inputs. In the void loop section there are two digital write commands one to go high one to go low, for each for loop. hope that helps

  • @FationJoni1994
    @FationJoni1994 7 ปีที่แล้ว +5

    for what i nned the crystal mouse ?

    • @IoTLearner
      @IoTLearner 6 ปีที่แล้ว +1

      21:37 ...For this bro..LOL

  • @salc9593
    @salc9593 9 ปีที่แล้ว +2

    Great Tutorials.... Being a Neophyte to Arduino programing I have learn a great deal from your Tutorials. I do have a question in regarding to this one.... Is it possible to right a line of programing to have the LED Pause at pin 5 every 5 loops for a couple seconds (I've added pin 8 to the sketch) then continue.
    Thank you once again for your tutorials

    • @programmingelectronics
      @programmingelectronics  9 ปีที่แล้ว

      Sal C Yes, this is definitely possible. You could add an "if statement" in side the for loop that checks for the 5th pin, and add an additional delay inside the loops, maybe something like this:
      for (int thisPin = 2; thisPin < 8; thisPin++) {
      // turn the pin on:
      digitalWrite(thisPin, HIGH);
      delay(timer);
      //if pin 8 is illuminated, keep it on for a while longer
      if (thisPin == 8){
      delay(3000);
      }
      // turn the pin off:
      digitalWrite(thisPin, LOW);
      }
      Hope this helps some.

    • @salc9593
      @salc9593 9 ปีที่แล้ว +1

      Open Source Hardware Group Thank you very much for your replay and the code. It is most kind of you at OSHG.

  • @wonderwang1585
    @wonderwang1585 ปีที่แล้ว

    Appreciate it, it’s easier for me to learn programming. I just wondering what’s nuisance about the figurine?

  • @apotato26
    @apotato26 5 ปีที่แล้ว

    I really need to ask a question, shouldn't that the first and the second for loop use "thisPin < 7"?
    Cuz thisPin will change to 8 until stopping the for loop
    I don't mean to be rude, but I just don't understand why it's using "8", please help🙏

  • @MikeNewham
    @MikeNewham 6 ปีที่แล้ว

    Hi all, need some help on the following "For Loop Application: Sequencing Through Multiple LEDs" challenge -
    ...See if you can incorporate the 'thisPin' variable into the 'delay time' of each blink, so that each time through the loop, the delay time also changes....
    Any ideas?