EEPROM
The D21G does not have any built-in EEPROM as the usual Arduino chips have, but the board includes external EEPROM over I2C. Addresses are 0x50, 0x51, 0x52, 0x53.
Each of the 4 I2C addresses have 255 bytes available; in total 1kByte.
This EEPROM can be used with this library, or you can also use the Wire library directly to read/write bytes.
Check out this example sketch that uses the above library to write/read byte, long, and float types (including the conversions), output on the left.
WDT - Watchdog Timer
The Adafruit SleepyDog library works on the D21G as in this example.
It requires the installation of the ASF core library too.
The above example activates a watchdog timer of 4 seconds, and goes through 10 loops that include a watchdog.reset() which tells the WDT that all is fine. Then it starts a delay() that is longer than the WDT period, so after 4 seconds the unit resets and starts the sketch again.
SLEEP
This library also has a sleep function to reduce power consumption. Have a look at the library example 'sleep.ino' and use the function (for 5 seconds sleep)
int sleepMS = Watchdog.sleep(5000);
My test on a PROTO D21G show (12V on Vin):
- awake, full backlight: 8mA (may be higher on more recent batches)
- awake, no backlight: 5-7mA
- sleeping, no backlight: 2mA
- awake, full backlight: 17mA (may be higher on more recent batches)
- awake, no backlight: 13mA
- sleeping, no backlight: 4mA
For an IND.I/O D21G the results are (12V, I/O channels not connected to anything):
- awake, full backlight: 180mA
- sleeping, no backlight: 175mA