Once time innitialisation in void loop

Hello ,every body's !

I have two led connected on pin 2 and pin 3

Led 2 is onceCy_2
Led 3 is onceCy_3

I use the switch case function to select , which my cycle led sequence must done.

When i select position 1

My led 3 must blink one time ,and my led 2 blink continuously .

when I select position 0 , nothing blink .

My problem is :

The led 3 blink one time ,after this is the led 2 which blink .
But the cycle come back and my led 3 blink a second time and the led 2 after .

Like how a loop must work .

I tested different type of exit

like while (1) {}, but my led 2 won't work ,

I tested too a for loop

(int i = 0,i == 1 ,i++)
{
// led 3
i++
}
// led 2

To explain my request

These two led simulate , a display initialisation for the led 3 and the sequence of the page for the led 2 .

This is why I need one once blink for the led 3.

Even it's not done , my loaded page work ,but blinking continuously ,due to the always loop cycle and the alway initialisation .

I need this innitialisation between all page or previous page sur impressed on the new .

Thanks for any help

v1.0.0.ino (550 Bytes)

I tested too a for loop

(int i = 0,i == 1 ,i++)
{
// led 3
i++
}

It is past time for you to understand the basics of C/C++ functions and statements.

Statements always end in ;.

Your for loop says "starting with i equal to 0, while i equals 1, do this...". Just how many times is this going to happen? NONE!

I need this innitialisation between all page or previous page sur impressed on the new .

I need THAT explained. That makes no sense.

      while (select_0 > 1);

The while statement at the start of a while loop must not be followed by a semicolon unless you want the semicolon to be the only code to be dependant on the while condition.

Will select_0 ever be greater than 1 considering that you have mapped its value to either 0 or 1 ?

Even if that were possible then how would its value change once the while loop has been entered ?

hello,

"It is past time for you to understand the basics of C/C++ functions and statements.

Statements always end in ;."

"The while statement at the start of a while loop must not be followed by a semicolon unless you want the semicolon to be the only code to be dependant on the while condition."

Simply error , I had see it after ,(quickly must go to work )...

"Will select_0 ever be greater than 1 considering that you have mapped its value to either 0 or 1 ?"

Yes , I use one analog input as a 2 position selector, where actualy need just position 1 for my sequence and position 0 ,as nothing or standby.

I just change my program to a new version ,modified with a flag before "void setup()"

It work like I want ,but with a other problem ...

Now my first led blink once a time ,and the second blink continuously .

Like I wanted, yes ,

But when ,I come out of case 1 ,I come back and now ,my first led won't blink,
this is just the led 2 wich only blink .

When i entering in a selection ,I always need to first led, blink once a time and after the second.

Now I need to resetting my flag ,when I change selection !

A new problem ...

v1.0.1.ino (1.07 KB)

What is the point of a switch/case when you only have code for case 1 ?

Why are the pinMode()s in loop() and not in setup() ?

Hello,

"What is the point of a switch/case when you only have code for case 1 ?"

This is just to facilitate my searching about this initialisation trouble.
In accordance that I use switch /case function ,in my real program.

I use this function for calling different external loop, which represent differant pages on my display .

"Why are the pinMode()s in loop() and not in setup() ?"

I declare pinMode in void loop, cause ,

I readed that declare a variable in top, rayon ,along my complete program ,even I don't need that variable, rather than in the specific placement where it's realy necessary.

Rayon on all the program ,ask more memory allocation as in a specific location.

That's what I readed.

Perhaps ,that I bad explain ,but I just beginning in arduino programming and use in paralell a learning book.

To explain my initialisation problem ,I attach my actual real program ,where my initialisation ,put problem .

This is most complex to explain ,with this sketch.

v1.0.4.ino (14.5 KB)