Skip to main content
deleted 293 characters in body
Source Link

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition checkPS:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // a delay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another @lurker's suggestion in the comments :- check the code would run smoothly if you add a delaybaud rate setting in your serial monitor as well at the appropriate places.

PSEDIT: Those who wish to editI admit that the code in the previous version of this answer may editwas foolishly typed out by me due to lack of patience, so I'll make up for my mistake(not in code, but as wella full answer).

First of all, I doubt if the condition input_password[5] == NULL anddidn't understand what you wanted to do with the statement input_password[counter] = char(Serial.readString())Incoming_value were rightly stated.

PS: @lurker's suggestionvariable in your sketch, so I'm not gonna talk about it; I'd suggest adding a sufficiently small delay at the comments - checkend of the baud rate settingcode in yourthe loop. This should provide the serial monitor as wellport some time to handle the incoming data and stop printing the confusing output (perhaps; just because delays make your microcontroller wait for a while to get things done elsewhere , especially where the reception of data is slow and thus avoid collisions)

Also note that I am not a CS student or an electronics geek, but I am speaking from my guesswork. Any correction is accepted.

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // a delay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL and the statement input_password[counter] = char(Serial.readString()) were rightly stated.

PS: @lurker's suggestion in the comments - check the baud rate setting in your serial monitor as well.

PS: @lurker's suggestion in the comments - check the baud rate setting in your serial monitor as well.

EDIT: I admit that the code in the previous version of this answer was foolishly typed out by me due to lack of patience, so I'll make up for my mistake(not in code, but as a full answer).

First of all, I didn't understand what you wanted to do with the Incoming_value variable in your sketch, so I'm not gonna talk about it; I'd suggest adding a sufficiently small delay at the end of the code in the loop. This should provide the serial port some time to handle the incoming data and stop printing the confusing output (perhaps; just because delays make your microcontroller wait for a while to get things done elsewhere , especially where the reception of data is slow and thus avoid collisions)

Also note that I am not a CS student or an electronics geek, but I am speaking from my guesswork. Any correction is accepted.

added 109 characters in body
Source Link

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // a delay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL and the statement input_password[counter] = char(Serial.readString()) were rightly stated.

PS: @lurker's suggestion in the comments - check the baud rate setting in your serial monitor as well.

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // a delay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL and the statement input_password[counter] = char(Serial.readString()) were rightly stated.

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // a delay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL and the statement input_password[counter] = char(Serial.readString()) were rightly stated.

PS: @lurker's suggestion in the comments - check the baud rate setting in your serial monitor as well.

added 225 characters in body
Source Link

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // relateda statementsdelay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL was and the statement input_password[counter] = char(Serial.readString()) were rightly stated.

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    // related statements
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL was rightly stated.

First, I'd suggest that you make the variable to hold the input password an array so as to do the following condition check:

char input_password[6] //I put 6 here assuming that your password is a six-digit password
// rest of the initialisation code (including void setup()) beneath this

void loop(){
        int counter = 0
        if(Serial.available() & (input_passwrod[5] == NULL)){
                    input_password[counter] = char(Serial.readString());
                    counter++;
                    delay(1000); // a delay of one second to make the flow a bit 
                                 // smooth. 
        /* Reducing the delay may also work, but I put a one-second delay 
           considering how slow others may type */
        }
        //rest of the code here
}

Another suggestion : the code would run smoothly if you add a delay as well at the appropriate places.

PS: Those who wish to edit this answer may edit as well. I doubt if the condition input_password[5] == NULL and the statement input_password[counter] = char(Serial.readString()) were rightly stated.

Source Link
Loading