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
}

= assignment, not comparison -- inside if (...)

== comparison


Arduino Forum > Using Arduino > Programming Questions > if condition is not working with input/output commands.


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'