<avr/eeprom.h>

Hello,

I am using adafruit trinket Mo and when I try to upload the code to the board it throws the following error.

Documents\Arduino\libraries\EEPROM-master/EEPROM.h:26:24: fatal error: avr/eeprom.h: No such file or directory
#include <avr/eeprom.h>
* ^*
compilation terminated.
exit status 1
Error compiling for board Adafruit Trinket M0.

What would be the reason for this? It would be helpful to me if someone could solve this issue.

Thanks!

You’re trying to use an AVR architecture specific library with a board that is SAMD architecture. That will never work. The Trinket M0 doesn’t even have EEPROM.

I recommend deleting Documents\Arduino\libraries\EEPROM-master. Since the EEPROM library is architecture specific, it is bundled with each hardware package. So installing that library to your sketchbook will only cause problems.

Thank you for your reply. I just have one more doubt. I am trying to assign values to the variables in my code through serial communication from Processing. The variables are getting assigned but once the Trinket module it powered off and then when again it is power back on the variables are reset to initial and the values it were assigned is lost. So is there a way to assign these variables from Processing so that the data remains unchanged?

So is there a way to assign these variables from Processing so that the data remains unchanged?

No. All variable values are lost when the Arduino looses power.

You can save the value in any variable into EEPROM, and, on power up, read the values in EEPROM and store then in the correct variables.

It looks like this will be a good solution for you: https://github.com/cmaglie/FlashStorage Note carefully the warning that flash memory is rated for only about 10000 writes so you need to write your code to ensure that you don't unnecessarily write to flash over and over again, which could ruin your Trinket very quickly.

Just to clarify, didn't you say this was for the Trinket M0 in your original question? If that's true, then some of the suggestions about using AVR/eeprom are not solutions. I, too, have an M0 board (SAMD) and was a bit disappointed that I didn't read the fine print. I guess I'll add a small EEPROM chip via I2C to store variables to non-volatile memory. I just need 512-1024 K or so.

Govner:
Just to clarify, didn’t you say this was for the Trinket M0 in your original question? If that’s true, then some of the suggestions about using AVR/eeprom are not solutions. I, too, have an M0 board (SAMD) and was a bit disappointed that I didn’t read the fine print. I guess I’ll add a small EEPROM chip via I2C to store variables to non-volatile memory. I just need 512-1024 K or so.

The Microchip 24LC256 is a popular choice for add-on EEPROM. You get 32KB (256Kb) in an eight pin package and there’s a fair bit of community support.