Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char code[5] = {'2', '0', '6', '1', '8'};
- char getCode[5];
- int isCorrect = 0;
- void setup() {
- Serial.begin(9600);
- for (int i = 0; i < 5; i++) {
- while (Serial.available() == 0);
- getCode[i] = Serial.read();
- if (getCode[i] == code[i]) {
- isCorrect++;
- }
- }
- if (isCorrect == 5 ) {
- Serial.println("Welcome");
- }
- else {
- Serial.println("Wrong code, try again");
- }
- }
- void loop() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement