Arduino Workshop - Chapter Three - FOR Loops

Поделиться
HTML-код
  • Опубликовано: 6 мар 2017
  • The full Arduino Workshop in step-by-step format can be found here core-electronics.com.au/tutor...
    In this section, you'll look at 'for' loops which you can use to control the flow of your program.
    We're official retailers for Arduino in Australia - powered by makers, for makers! core-electronics.com.au/ardui...

Комментарии • 37

  • @geoffwade8144
    @geoffwade8144 3 года назад +2

    I’ve just discovered your channel and really like it, good job.

  • @RajaSingh-hs2tb
    @RajaSingh-hs2tb 4 года назад +1

    You explained very well

  • @salc9593
    @salc9593 6 лет назад +2

    Thank you for posting this video, it has been a great help in my learning of Arduino coding. I would like to ask if I wanted to have this LED ramp 5 times would I add the first part of the code you show at min: 0:20 around the ramp code by using curly bracket? Thank you again for posting these videos.

  • @attalaw36
    @attalaw36 4 года назад +2

    nice lesson thank you ...

  • @waluxstudio7921
    @waluxstudio7921 4 года назад +1

    Thanks for explanation. I like it

  • @whitefields5595
    @whitefields5595 5 лет назад +1

    As you only want to count 0-255 would you save memory if you defined i as a BYTE datatype rather than an INT?

  • @puvaneswaransivakumar9469
    @puvaneswaransivakumar9469 3 года назад +3

    Can I know how to loop forever the melody example in arduino??

  • @johnnagy1575
    @johnnagy1575 3 года назад +2

    I don't want to ramp up and down. Just want to blink the led 5 times. Stop. And wait for a Button push again. Any videos on that??

  • @jean_pattat1204
    @jean_pattat1204 5 лет назад +1

    i had troble with this so i watched other videos and i found the error you must be plugged in with a digital pwd most bords have these and are marked with a ~

  • @geneh9210
    @geneh9210 2 года назад

    What does the statement "for(;;);" do? I've seen it in a couple of example sketches. Thanks.

  • @nuwanchathuranga8479
    @nuwanchathuranga8479 3 года назад +1

    thanks a lot.....

  • @tareksma1
    @tareksma1 2 года назад

    Thanks for sharing. I finally understood the for loop. Now I kinda feel dump for not being able to understand it sooner 🙃 😕

  • @Chriss.lindstrom
    @Chriss.lindstrom 6 лет назад +2

    How do I make the code jump out of the 'for' loop? As soon as it counts to 5 for me, it starts over at 0 and jumps straight back into the loop. I want the value of x to stay at 5 until I press a button.

    • @d3bbi339
      @d3bbi339 4 года назад

      i believe you would add
      break;
      inside of the "for" loop. but im just referencing his previous video about "while" loops so i might not be correct. lol

  • @Perdonadoooooo
    @Perdonadoooooo 3 года назад +3

    In case someone else's LED only ramps down and not up, write "for(int i=0; i < 256; i++)" instead of the first _for_ shown in the video. Mine behaved like so and with that correction it now works properly. I'm guessing "int i" doesn´t declare AND set the variable to 0, so that's why it only ramped down. Someone correct me if im wrong

    • @jeffturtle3565
      @jeffturtle3565 4 месяца назад

      Yeah I'm pretty sure you're right. He had a typo for sure.

  • @infatum9
    @infatum9 5 лет назад +7

    I think they chose i for for loops because it stands for iterations.

    • @Sedokun
      @Sedokun 3 года назад

      It stands for 𝑖, 𝑗 indexing Index Notation in math. [Aᵢ ⱼ] where 𝑖 - index, 𝑗 - is just the next letter for labeling the next dimension (then goes 𝑘, 𝑙, 𝑚, 𝑛 ...)

  • @timwhite7127
    @timwhite7127 6 месяцев назад

    Nice. fyi, 'i' is used for convention in loops to indicate "iterations".

  • @-stoner
    @-stoner Год назад

    I'm trying to make a game where LED's blink back and forth and when you press a button it stops on the LED it's on and gives a certain point value for each LED but the for loop keeps iterating and blinking the LEDs

  • @viktortousseyn7698
    @viktortousseyn7698 Год назад

    How do you do 7 led lampjes burning

  • @omtandon2741
    @omtandon2741 3 года назад +1

    I searched this on youtube for the same thing!!!

  • @scopellafranqui
    @scopellafranqui 5 лет назад +8

    I've had to change "int i" for "int i = 0" in my first for loop otherwise each loop starts with i having a value of 255. i.e. if I don't add "int i = 0" the LED starts each loop at max brightness then fades instead of ramping up then fading.

    • @vinothparker7425
      @vinothparker7425 4 года назад

      i'm also facing the same issue right now. i want to know the reason why this is happening like sir. can you help me?

    • @vinothparker7425
      @vinothparker7425 4 года назад

      void setup()
      {
      Serial.begin(9600);
      }
      void loop()
      {
      int i;
      for(i; i

    • @mr.m_photographs
      @mr.m_photographs 4 года назад +1

      Same thing happened to me. This fixed it.

    • @robertaragon8270
      @robertaragon8270 3 года назад

      same

  • @PAWNB3YOND
    @PAWNB3YOND 4 года назад +1

    I love you.

  • @danieljohnsopardenilla997
    @danieljohnsopardenilla997 4 года назад +3

    So a 'for' is like a sub loop?

    • @Sedokun
      @Sedokun 3 года назад

      It is. And this is why this code is "blocking" it halts the Loop until For is finished.

  • @firealarmswithcolton5169
    @firealarmswithcolton5169 2 года назад

    my brother told me i need a for loop for a buzzer tone sequence on an if but this video made no sense to me.

  • @vinothparker7425
    @vinothparker7425 4 года назад +2

    void setup()
    {
    Serial.begin(9600);
    }
    void loop()
    {
    int i;
    for(i; i

    • @Core-Electronics
      @Core-Electronics  4 года назад

      tricky ! If you can, please post this to our forum coreelec.io/forum - our team can provide better support for coding issues there.

    • @pranilshoots9523
      @pranilshoots9523 2 года назад

      Its becaude the ASCII equivalent of 0is 52. You need to convert it to integer to see correctly in serial monitor

  • @ryanbennett8434
    @ryanbennett8434 2 года назад

    If this doesn't work for you then make sure you are using the digital pins (NOT analog).