if condition is not working with input/output commands.
hello, why following simple blink test code not working should?
the variable not going step step (1 2 3 etc.. 9) 9, jumps 9. if(a=10) ignored!?
int a;
void loop() {
a++; if(a=10)a=0;
if(a=9)digitalwrite(13, high); // turn led on (high voltage level)
delay(1000); // wait second
if(a=9)digitalwrite(13, low); // turn led off making voltage low
delay(1000); // wait second
}
the variable not going step step (1 2 3 etc.. 9) 9, jumps 9. if(a=10) ignored!?
int a;
void loop() {
a++; if(a=10)a=0;
if(a=9)digitalwrite(13, high); // turn led on (high voltage level)
delay(1000); // wait second
if(a=9)digitalwrite(13, low); // turn led off making voltage low
delay(1000); // wait second
}
= assignment, not comparison -- inside if (...)
== comparison
== comparison
Arduino Forum > Using Arduino > Programming Questions > if condition is not working with input/output commands.
arduino
Comments
Post a Comment