FOR loop problem

I have a variable that can have two different values, and I want the FOR loop to iterate for that specific value, but it seems like the code does not even enter the For loop.

I have:

int roundstate; // hold value of switch position (high/low)
int rd;

if(roundstate == HIGH)
rd = 180000;
rd = 120000;

for(int i = rd; i > 0; i--){
// do something

The (int i = rd) is giving me a problem. Why is this and whats an easy way to fix it? thank you

You need to post ALL of your code (in code tags using the </> icon).
120000 and 180000 are too big for an int.


What for loop? Please read the "how to use the forum" stickies. They will tell how to format and post code. Also it is requested that you post the whole code for your sketch or a small, complete, sketch that illustrates your problem.

What does:


Tell you?