Hi friends, I need help, please help.
I read a password from a text file and put it in a string to be the main password.
Then I want to enter the password from the input of the monitor serial.
But when I compare them, even though the strings are the same. Does not enter the condition.
How do I make an equal condition?
Code:
#include <SD.h>
File M_Pass;
String Password_From_SD="";
void setup() {
Serial.begin(115200);
SD.begin(10);
Get_str_From_SD();
}
void loop() {
Menu();
}
void Menu(){
String Enter_Password_Serial="";
Serial.println("Enter Password:");
while (!Serial.available());
Enter_Password_Serial = Serial.readString();
Serial.print("Enter_Password_Serial:");
Serial.println(Enter_Password_Serial);
Serial.print("Password_From_SD:");
Serial.println(Password_From_SD);
if(Enter_Password_Serial==Password_From_SD){
int buttom_menu=0;
Serial.println("request number:");
Serial.println("1.Something");
Serial.println("2.Something");
}
else{
Serial.println("Password incorrect");
}
}
void Get_str_From_SD(){
M_Pass=SD.open("PM.txt");
char character;
while (M_Pass.available())
{
character = M_Pass.read();
Password_From_SD += character;
}
}