save password.

Hi. We are doing a job for the school with arduino. What we have in mind is to make an electronic lock, in which you enter a password and this allows us to open a door.

The issue is that we cannot use libraries except for the screen library and EEPROM memory. We already have the keyboard based on if and it works correctly, but what we cannot do is that when we want to enter the password we do not know how to get a value of 4 digits (password) separated in units of one thousand, one hundred, ten, unit to then compare it with the value already saved in the EEPROM.

What type of value do you get from the keyboard? Is it a char? If yes, the char may be coded in ASCII. Then the keys from 0 to 9 are coded from 48 to 57, and you can compute the real value using

byte myValue = myChar - 48;

Or you can do this with a switch / case if you have also letters.

Then the first value will be thousands, the second hundred, and so on.

thanks for the reply. The values ​​obtained on the keyboard are only integers. we will not use letters, therefore it is not necessary to use a variable char.

Again: "What type of value do you get from the keyboard?" in other words, how do you declare it in your code?

A char is the same as a byte, both are numbers from 0 to 255 but the char displays "characters" when printed. But if your variable is an int or a byte, the '0' will be equal to 0, if it is a char, the '0' will be 48.

lesept: Again: "What type of value do you get from the keyboard?" in other words, how do you declare it in your code?

What @lesept is trying to say is, post the code that you have so far. The answer depends on your code and as long as you keep your code a secret you can't get an answer that you can rely on.