View Single Post
  #3  
Old 06-10-2019, 10:43 AM
jwoody's Avatar
jwoody (Jeremy)
Registered User

jwoody is offline
 
Join Date: Aug 2011
Location: Ormeau Hills, Australia
Posts: 375
Hello Damien
I am not experienced in coding so the simpler the better
I have just been copying and pasting code then uploading it.

This is the one of the sketches I have been using -

/*
* EEPROM Clear
*
* Sets all of the bytes of the EEPROM to 0.
* Please see eeprom_iteration for a more in depth
* look at how to traverse the EEPROM.
*
* This example code is in the public domain.
*/

#include <EEPROM.h>

void setup() {
// initialize the LED pin as an output.
pinMode(13, OUTPUT);

/***
Iterate through each byte of the EEPROM storage.

Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage.
- Arduino Uno: 1kb EEPROM storage.
- Arduino Mega: 4kb EEPROM storage.

Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors.
***/

for (int i = 0 ; i < EEPROM.length() ; i++) {
EEPROM.write(i, 0);
}

// turn the LED on when we're done
digitalWrite(13, HIGH);
}

void loop() {
/** Empty loop. **/
}


I kind of know what I am looking at in the code. I also read somewhere that rather than a zero being used to replace the values it should be a 1 or 255?
Thanks for your help
Jeremy
Reply With Quote