Brilliant For-loop Bug
Hello Bernard,
Sounds great. Thanks for clarifying.
The first for is not ignored by the compiler.
I have attached the SW4STM32 project and two video clips showing evidence of this and for you to reproduce the phenomenon at your location.
Before calling your help I also tried rectifying the situation using different variables for each for-loop which didn’t help. I am not sure why the compiler would deem a variable fixed, that’s awkward, especially when used in a variable changing function such as a ‘for’. Under any other circumstances this has never caused me issues. Probably Arduino IDE is to blame for this ... and our good old Microsoft Basic.
I believe there must be a compiler setting in Eclipse for such awkward compiling events to be prevented from happening. If a variable is clarified and a for-loop uses it it is obvious not to be a fixed number just to be stored somewhere. So I think the Eclipse/Plugin compiler optimizations here are rather pedantic and not offering any smooth learning curve for the autodidact. I like to call them quircks that cause forums and helpdesks to clog up.
Greets,
Ben
PS: In the attached video you see the SMD green led (PC13 3.3v to GPIOC_13) and 2 conventional green leds (PC14 and PC15 GND to GPIOC_14 and GND to GPIOC_15) hence the SMD led’s inversal.