Control Structures and what variable types work
hello have looked , search web , several forums have not found place says variable types work in control structures. trying use if statement double type variable , wont execute. changed variable int type , worked fine. control structures work int type variables? trying run variable on possible variations , find 1 best fits need. 'a' variable 1 double , have made int changing decimal integer. want know.
code: [select]
void loop()
{
count = count + 1;
if (count == 100)
{
count = 0;
= + 1;
serial.println("");
serial.println("");
}
if (count == 99)
{
if (a == 99)
{
serial.end();
}
}
any primitive type usable. floats equivalent double on arduino ( no double precision ).
however float set 100.00 may not equal int set 100 ( literal number integer default ),
maybe try comparing terms:
however float set 100.00 may not equal int set 100 ( literal number integer default ),
maybe try comparing terms:
code: [select]
double d = 100.0f;
if( d == 100.0f ){ //f float literal specifier.
//...
}
Arduino Forum > Using Arduino > Programming Questions > Control Structures and what variable types work
arduino
Comments
Post a Comment