i want to write data to flash. i googled it that arduino zero will emulate the EEPROM when i use EEPROM library.
but i got this error:
/Users/Carl/Documents/Arduino/BTLock_implement/BTLock_implement.ino:1:20: fatal error: EEPROM.h: No such file or directory
#include <EEPROM.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Zero (Programming Port).
how can i include it into my project?
thanks.
I might be wrong, but I don't think that anyone's got the EEPROM emulation working on the Zero yet.
If this is the case, then your best bet is to use an external EEPROM such as MicroChip's 32KB, I2C based 24LC256 serial EEPROM. It's widely available in a variety of memory and package sizes (including an 8-pin DIP) and moreover it's easy to use. It has the advantage of being far more durable than flash memory, having a minimum of 1 million write cycles. There's also an SPI version, the 25LC256 and probably loads other devices as well.
I wrote a small library that combines example code from Hobbytronics.co.uk and the EEPROMAnything.h library, which allows you to read or write any type or data structure to/from a 24LC256 EEPROM. Here's the link: EEPROM by emulation?? - Arduino Zero - Arduino Forum
No way to fix that?
Because I am using Arduino zero for experiment.
Eventually, I will use the other 3.3v Arduino board instead.
So, I want my code can be portable for other Arduino boards.
Thanks.
If it's portability between Arduinos that you require and you're just using EEPROM.read() and EEPROM.write(), then you can still seamlessly use the library with the 24LC256, all you need to change in your sketch is the include line, from:
#include <EEPROM.h>
to
#include <ExtEEPROM.h>
... and just include the Wire (I2C) library and activate it using Wire.begin().
The rest of your code won't require any additional changes, it'll work the same as if you're writing and reading to an AVR based Arduino's EEPROM. I wrote the library this way, because I also faced the same problem and needed to migrate my code between an Arduino Mega and an Arduino Zero.
Sorry! I don't want to buy extra component if there has a space for that.
Thanks anyway.