Arduino Workshop - Chapter Three - FOR Loops

preview_player
Показать описание

In this section, you'll look at 'for' loops which you can use to control the flow of your program.

Рекомендации по теме
Комментарии
Автор

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

geoffwade
Автор

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??

johnnagy
Автор

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

infatum
Автор

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

puvaneswaransivakumar
Автор

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

timwhite
Автор

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

whitefields
Автор

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.

scopellafranqui
Автор

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

tareksma
Автор

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

Perdonadoooooo
Автор

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.

salc
Автор

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

geneh
Автор

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.

firealarmswithcolton
Автор

void setup()
{
Serial.begin(9600);
}

void loop()
{
int i;

for(i; i<100; i++)
{
Serial.println(i);
delay(1000);
}
}



i tried to print value from 0 to 100.. but the initial value of i is 52 instead of 0.. i don't know why its behaving like this. please some one help me.

vinothparker
Автор

So a 'for' is like a sub loop?

danieljohnsopardenilla
Автор

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 ~

jean_pattat
Автор

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

-stoner
Автор

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

omtandon
Автор

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.

Chriss.lindstrom
Автор

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

ryanbennett