PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0KB

  1. /*
  2. * EEPROM Clear
  3. *
  4. * Sets all of the bytes of the EEPROM to 0.
  5. * Please see eeprom_iteration for a more in depth
  6. * look at how to traverse the EEPROM.
  7. *
  8. * This example code is in the public domain.
  9. */
  10. #include <EEPROM.h>
  11. void setup()
  12. {
  13. /***
  14. Iterate through each byte of the EEPROM storage.
  15. Larger AVR processors have larger EEPROM sizes, E.g:
  16. - Arduno Duemilanove: 512b EEPROM storage.
  17. - Arduino Uno: 1kb EEPROM storage.
  18. - Arduino Mega: 4kb EEPROM storage.
  19. - Teensy 3.0 & 3.1: 2kb EEPROM storage.
  20. - Teensy-LC: 128b EEPROM storage.
  21. - Teensy 2.0: 1kb EEPROM storage.
  22. - Teensy++ 2.0: 4kb EEPROM storage.
  23. Rather than hard-coding the length, you should use the pre-provided length function.
  24. This will make your code portable to all AVR processors.
  25. ***/
  26. for ( unsigned int i = 0 ; i < EEPROM.length() ; i++ )
  27. EEPROM.write(i, 0);
  28. // turn the LED on when we're done
  29. digitalWrite(13, HIGH);
  30. }
  31. void loop(){ /** Empty loop. **/ }