Go Down

#### redwind

##### Feb 24, 2013, 12:11 pmLast Edit: Feb 24, 2013, 12:20 pm by redwind Reason: 1
I am new to arduino but I am looking to create a coded garage door opener but instead of having to hook it up to a computer every time I want to change the password, I want to e able to do it from the keypad. I know that eeprom is available but it is only capable of handling up to a 255 value. and that would be fine if I only wanted to use a 3 digit pin but honestly who only uses 3 digits? I am looking to store any amount of digits that I would want to use at any given time.

#### UKHeliBob

#1
##### Feb 24, 2013, 12:19 pm
Bearing in mind that this is the Programming Questions section of the forum, what is your question ?

You don't store the password as a single number, you store it as a series of single digits.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

#### majenko

#2
##### Feb 24, 2013, 12:25 pm
The EEPROM can store a value between 0 and 255 in each of its memory locations.

Typically it has 1024 EEPROM memory locations.

I mean, seriously, who uses a 1024 digit PIN?

You store the first number (1) in EEPROM memory location 0.
You store the second number (0) in EEPROM memory location 1.
You store the third number (6) in EEPROM memory location 2.
You store the third number (6) in EEPROM memory location 3.

etc.

#### redwind

#3
##### Feb 24, 2013, 12:26 pm
my question is how to go about storing a larger number. but from what I am understanding from what your saying is that instead of using a sing int I should use multiple int

ex:
int p1 = 1
int p2 = 2
int p3 = 3
int p4 = 4

int p = 1234

#### UKHeliBob

#4
##### Feb 24, 2013, 12:42 pm
Yes, or better, put the password in an array.
Code: [Select]
`int password[] = {'1','2','3','4'};`
This makes it very much easier to refer to each number without repeating code.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

#### majenko

#5
##### Feb 24, 2013, 12:43 pm

Yes, or better, put the password in an array.
Code: [Select]
`int password[] = {'1','2','3','4'};`
This makes it very much easier to refer to each number without repeating code.

Don't use int's.  The Arduino is an 8 bit machine.  Using ints to store a small value (<256) is incredibly inefficient and wasteful.

You should use byte.

#### UKHeliBob

#6
##### Feb 24, 2013, 12:45 pm
Quite right !
int almost types itself.  Bad habit.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up