PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

60 líneas
1.0KB

  1. /***
  2. eeprom_iteration example.
  3. A set of example snippets highlighting the
  4. simplest methods for traversing the EEPROM.
  5. Running this sketch is not necessary, this is
  6. simply highlighting certain programming methods.
  7. Written by Christopher Andrews 2015
  8. Released under MIT licence.
  9. ***/
  10. #include <EEPROM.h>
  11. void setup() {
  12. /***
  13. Iterate the EEPROM using a for loop.
  14. ***/
  15. unsigned int index = 0;
  16. for( index = 0 ; index < EEPROM.length() ; index++ ){
  17. //Add one to each cell in the EEPROM
  18. EEPROM[ index ] += 1;
  19. }
  20. /***
  21. Iterate the EEPROM using a while loop.
  22. ***/
  23. index = 0;
  24. while( index < EEPROM.length() ){
  25. //Add one to each cell in the EEPROM
  26. EEPROM[ index ] += 1;
  27. index++;
  28. }
  29. /***
  30. Iterate the EEPROM using a do-while loop.
  31. ***/
  32. unsigned int idx = 0; //Used 'idx' to avoid name conflict with 'index' above.
  33. do{
  34. //Add one to each cell in the EEPROM
  35. EEPROM[ idx ] += 1;
  36. idx++;
  37. }while( idx < EEPROM.length() );
  38. } //End of setup function.
  39. void loop(){}