It is little bit difficult to control. The location of the increment is critical.
//========program================================
int a;
void setup()
{
Serial.begin(9600);
Serial.println("test of if");
a=1; //set a value for variable a
}
void loop()
{
if (a++, a <>20)
{
Serial.println("else if");
delay(10000);
}
else
{
Serial.println("else section");
delay(5000);
}
}
0 件のコメント:
コメントを投稿