#include <SPI.h>
#include <SD.h>
File myFile;
int output = 8;
void setup() {
Serial.begin(9600);
if (!SD.begin(10)) { //make sure sd card was found
while (true);
}
delay(2000);
}
void loop() {
String password = "xyz123#";
//String sdhc = myFile.read();
//Serial.println(sdhc);
myFile = SD.open("txt_file.txt");
if (myFile) {
while (myFile.available()) {
if (password = myFile.read()) {
digitalWrite(output, HIGH);
Serial.print("\nUnlocked");
}else{
digitalWrite(output, LOW);
Serial.print("\nLocked");
}
delay(300);
}
myFile.close();
}
}