Go Down

Topic: Access to EEPROM not working on Mega 2560 (Read 2020 times) previous topic - next topic

bossertj

There appears to be a problem with access to EEPROM on the Mega 2560.  The following simple program, compiled using Arduino 21 produces an "Error Compiling" message when attempting to upload the compiled program to the Mega 2560.


#include <EEPROM.h>

void setup(void)
{
 Serial.begin(9600);
} // end setup()


void loop(void)
{
 byte temp;
 
 Serial.println("writing to EEPROM[0]");
 EEPROM.write(0,1);
 Serial.println("reading from EEPROM[0]");
 temp=EEPROM.read(0);  
 delay(500);

}

Coding Badly


http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278172720

http://www.cbxdragbike.com/arduino/new/


tangomad

OK, But if I made this update, EEPROM work, but I cant use Serial2 (I work with Arduino Mega.)

Code:
Serial.begin(19200);
 Serial2.begin(9600);

Error:
controlcli101x3.cpp: In function 'void setup()':
controlcli101x3:71: error: 'Serial2' was not declared in this scope

GrooveFlotilla

Have you got the right board selected?
Some people are like Slinkies.

Not really good for anything, but they bring a smile to your face when pushed down the stairs.


tangomad

I'm sorry, I'm working with a One and a Mega and the same time :)

ok, thanks.

bossertj

Thank you "Coding Badly".

EEPROM access on the Mega 2560 works if I replace the file eeprom.h in the hardware/tools/avr/avr/include/avr directory as you describe at http://www.cbxdragbike.com/arduino/new/

:)

Coding Badly


You are welcome for the link.  The big "thank you" goes to Mark Sproul; it's his website.

Go Up