Go Down

Topic: reprogramable password (Read 495 times) previous topic - next topic

redwind

Feb 24, 2013, 12:11 pm Last 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

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

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.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

redwind

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

instead of
int p = 1234

UKHeliBob

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


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.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

UKHeliBob

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