!= AuthedID[num]) break;
}
if (i == mfrc522.uid.size)
{
isAuthed = true; //验证通过
break;
}
else if (num == CARDS - 1) {
BeepFailed();
}
}
}
//蓝牙扫描
void BTCheck() {
Serial.println("BT Checking!");
if (BT.available()) {
val = BT.read();
Serial.println(val);
if (val == 'J') { //J表示开门信号
OpenDoor();
BeepChecked();
delay(3000);
isAuthed = false;
}
val = 0;
}
}
void BeepChecked() {
digitalWrite(BUZZ_PIN, HIGH);
delay(200);
digitalWrite(BUZZ_PIN, LOW);
}
void BeepFailed() {
digitalWrite(BUZZ_PIN, HIGH);
delay(100);
digitalWrite(BUZZ_PIN, LOW);
delay(100);
digitalWrite(BUZZ_PIN, HIGH);
delay(100);
digitalWrite(BUZZ_PIN, LOW);
}