Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
Your compiler might not use while(1)... if you use gcc/winavr it should. Try while(1==1). That has the same purpose and should work no mater what.
while(1){code here}
for(;;){code here}
I my program I have a few While(1) statement but they are not staying in a infinite loop. I don't see any way they are break out of the statement
QuoteI my program I have a few While(1) statement but they are not staying in a infinite loop. I don't see any way they are break out of the statementIf you are using AVR, make sure you turn off optimization in the makefile. An empty while loop would otherwise be deleted when compiled (as it is useless).
code: //yes, I really want you to type "code"//put your code heregoto code;
this is a bit more complex but it should work to as I see it:Code: [Select]code: //yes, I really want you to type "code"//put your code heregoto code;this should also be an infinite loop and should cancel out the chance of the compiler deleting the part of an infinite loop that makes it a infinite loop