Can anyone explain way when writing ‘a’ to the FRAM two hundred and seventy times, at two hundred and fifty five the program starts writing ‘a’ equaling zero and then ‘a’ equaling one and so on?
I’m using Adafruit I2C FRAM . It’s similar to Dynamic random-access memory.
Because "A" is defined as a byte. The maximum value for a byte is 255. Do the math!
test.ino (469 Bytes)
Please insert your code in the message using code tags.
#include "Adafruit_EEPROM_I2C.h"
Adafruit_EEPROM_I2C i2ceeprom;
#define EEPROM_ADDR 0x50 // the default address!
int a;
int value;
void setup(void) {
Serial.begin(9600);
i2ceeprom.begin(0x50);
for ( a = 1; a < 270; a++) {
i2ceeprom.write8(a, a);
Serial.print("write a: "); Serial.print(a);
Serial.print(" - ");
Serial.print("read a: "); Serial.println(value = i2ceeprom.read8(a));
}
}
void loop() {
}
The code and FRAM are working perfectly! Check the library for methods to store variable values larger than one byte.
The method named as write8
because it can store uint8_t type only.
Maximum of uint8_t is 255
The same is true for read8()
method too.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.