Library to write an RFID Code in the EEPROM in order to check if the Code corresponds to a Code already saved.
This library is used for saving an RFID Code to your Arduino's EEPROM or I2C EEPROM rather than your Code to avoid showing your RFID Code. To then check if the Code corresponds to a Code already registered.
Warning: you must use the same number of bytes in your functions as defined in the Constructor!
Go to the Libraries Manager on PlatformIO and search for RFID to EEPROM
. Then you just have to install it in your project.
Or use platformIO Core CLI
and paste the following command:
pio pkg install --library "gogovega/RFID to EEPROM@^1.1.0"
- Internal EEPROM
RFIDtoEEPROM(uint8_t byteNumber);
void begin(uint32_t eepromSize);
- I2C EEPROM
RFIDtoEEPROM_I2C(eeprom_size_t eepromSize, uint8_t address, uint8_t byteNumber);
void begin(twiClockFreq_t twiFreq);
Use one of the enumerations below to set EEPROM Size:
{
KBITS_1,
KBITS_2,
KBITS_4,
KBITS_8,
KBITS_16,
KBITS_32,
KBITS_64,
KBITS_128,
KBITS_256,
KBITS_512,
KBITS_1024,
KBITS_2048
}
And use one of the enumerations below to set twiClock (Wire) Frequence:
{
TWICLOCK100KHZ,
TWICLOCK400KHZ
}
Debugging makes it easier to find errors in a program. To use it, add the following function below your Serial begin and then open your Serial Monitor in order to receive error messages if there are any.
void beginDebug(Stream &debugPort);
This library contains several functions:
Name | Description |
---|---|
CardNumber() |
Returns the number of Cards already registered. |
SaveCard() |
Stores the RFID Code of a Card in the EEPROM. Returns true if the write succeeds. Otherwise returns false and restores the old Card. |
CardCheck() |
Checks if the Code received corresponds to a Code already stored in the EEPROM. Returns true if a Card matches. |
ClearCardNumber() |
Resets the number of recorded Cards to 0. |
EraseAllCards() |
Resets all Cards to 0. |
MaxCards() |
Returns the maximum number of recordable Cards. Currently set to 255. |
Note: The EEPROM memory has a specified life of 100,000 write/erase cycles (depends on models), so you may need to be careful about how often you write to it.
- Atmel AT24C256
- Microchip 24C65/P
- Be able to use the internal memory of the Raspberry Pi Pico.
- Increase the number of recordable Cards (currently set to 255).
- It is not possible to use the internal memory of the Raspberry Pi Pico, you must add an external I2C EEPROM.
- The Number of recordable Cards is fixed at 255.
- Change Log: whats changed?
MIT License
Copyright (c) 2022 Gauthier Dandele
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.