Arduino scetch的Theres问题 它的代码部分:
![void verifica(){
msg=msg.substring(1,13);
if(ID.indexOf(msg)>=0) Serial.println("Access granted.");
{
digitalWrite(10, HIGH);
delay(2000);
digitalWrite(10, LOW);
}
else Serial.println("Access denied.");
{
digitalWrite(9, HIGH);
delay(2000);
digitalWrite(9, LOW);
}
}
所以我编译时遇到了麻烦,看起来没有失败。对不起,是的,我n00b =( http://s019.radikal.ru/i608/1501/5e/db7c7db4380b.png
答案 0 :(得分:3)
您已收到else
但未附加if
。
据推测,println
应该在下面的块中,而不是if
语句的整个主体:
if(ID.indexOf(msg)>=0)
{
Serial.println("Access granted."); // <<< inside if body
digitalWrite(10, HIGH);
delay(2000);
digitalWrite(10, LOW);
}
else
{
Serial.println("Access denied."); // <<< inside else body
digitalWrite(9, HIGH);
delay(2000);
digitalWrite(9, LOW);
}