Hallo,
ich brauche Unterstützung bei dem Sketch der über die SparkFun Bibliothek läuft.
Ich möchte diesen gerne für ein externes EEPROM nutzen, komme aber nicht weiter.
Mein EEPROM befindet sich auf einem DS3231 und ist über die Adresse 0x54 erreichbar.
Wie bringe ich diese I2C Adresse im Sketch ein?
#include <Wire.h>
#include "SparkFun_External_EEPROM.h" // Click here to get the library: http://librarymanager/All#SparkFun_External_EEPROM
ExternalEEPROM myMem;
void setup()
{
Serial.begin(115200);
Serial.println("Qwiic EEPROM example");
Wire.begin();
if (myMem.begin() == false)
{
Serial.println("No memory detected. Freezing.");
while (1)
;
}
Serial.println("Memory detected!");
Serial.print("Mem size in bytes: ");
Serial.println(myMem.length());
//Yes you can read and write bytes, but you shouldn't!
byte myValue1 = 200;
myMem.write(0, myValue1); //(location, data)
byte myRead1 = myMem.read(0);
Serial.print("I read: ");
Serial.println(myRead1);
//You should use gets and puts. This will automatically and correctly arrange
//the bytes for larger variable types.
int myValue2 = -366;
myMem.put(10, myValue2); //(location, data)
int myRead2;
myMem.get(10, myRead2); //location to read, thing to put data into
Serial.print("I read: ");
Serial.println(myRead2);
float myValue3 = -7.35;
myMem.put(20, myValue3); //(location, data)
float myRead3;
myMem.get(20, myRead3); //location to read, thing to put data into
Serial.print("I read: ");
Serial.println(myRead3);
String myString = "Hi, I am just a simple test string";
unsigned long nextEEPROMLocation = myMem.putString(30, myString);
String myRead4 = "";
myMem.getString(30, myRead4);
Serial.print("I read: ");
Serial.println(myRead4);
Serial.print("Next available EEPROM location: ");
Serial.println(nextEEPROMLocation);
}
void loop()
{
}