#include<Wire.h>
#include<Eeprom24C32_64.h>
#define EEPROM_ADDRESS 0x000
void setup() {
Serial.begin(9600);
eeprom.initialize();
const word address = 0x000;
const byte count = 94;
byte inputBytes[count] = { 0 };
byte outputBytes[count] = { 0 };
Serial.println("Read bytes from EEPROM memory...");
eeprom.readBytes(address, count, outputBytes);
Serial.println("Read bytes:");
for (byte i = 0; i < count; i++) {
Serial.write(outputBytes[i]);
Serial.print(" ");
}
Serial.println("");
}
void loop() {
}
Next code... I have tried many sketches.
#include <EEPROM.h>
void setup () {
Serial.begin (115200);
Serial.println ();
for (int addr = 0x0000; addr < 0x0010; addr++) {
Serial.print ("Address = ");
Serial.print (addr, HEX);
Serial.print (", value = ");
Serial.println (EEPROM.read(addr), HEX);
}
} // end of setup
void loop () {
}
And most of the sketches check the internal EEPROM of the Arduino, not the external, stored on address 0x000. I want to read data from external AT24C32.
-
2And what have you tried...?Majenko– Majenko2017年12月20日 12:13:20 +00:00Commented Dec 20, 2017 at 12:13
-
1@IHaveQuestion Please don't post code in the comments. Edit your question and add the code there.sempaiscuba– sempaiscuba2017年12月20日 12:16:02 +00:00Commented Dec 20, 2017 at 12:16
-
@Majenko done code added plz help to solve thisI Have Question– I Have Question2017年12月20日 12:23:22 +00:00Commented Dec 20, 2017 at 12:23
-
@sempaiscuba done all codesI Have Question– I Have Question2017年12月20日 12:24:22 +00:00Commented Dec 20, 2017 at 12:24
1 Answer 1
You have to know what the I2C address of your EEPROM is. Right now you have
#define EEPROM_ADDRESS 0x000
The example from the library you cite has this:
/**************************************************************************//**
* \def EEPROM_ADDRESS
* \brief Address of EEPROM memory on TWI bus.
******************************************************************************/
#define EEPROM_ADDRESS 0x50
Then, you have to create an instance of the Eeprom24C32_64
object:
static Eeprom24C32_64 eeprom(EEPROM_ADDRESS);
That sets up the object for the EEPROM on the right I2C address, so you can later use the eeprom
object to read and write.
-
Your picture shows an LCD display. Are you expecting output to that?jose can u c– jose can u c2017年12月21日 03:44:43 +00:00Commented Dec 21, 2017 at 3:44