Arduino

Writing/Reading Integer 2D Arrays to/from Arduino’s Internal EEPROM

Arduinonun Harici EEPROM una Tamsayi Matris Yazip Okuma
2015-01-26 13_32_48-COM8

To download EEPROMex Library, please visit http://thijs.elenbaas.net/2012/07/extended-eeprom-library-for-arduino/

CODE:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <EEPROMex.h>
#include <EEPROMVar.h>

int address = 0;
int mode[16][6];
int i=0, j=0;
int modeEEPROM[16][6];

void setup()
{
Serial.begin(9600);
Serial.println("The 2D Array has been generated in order to write into EEPROM :");
 //Set the mode matrix all 0's
 for(i=0;i<16;i++){
   for(j=0;j<6;j++){
     mode[i][j]=i+j;
   }}

for(i=0;i<16;i++){
  Serial.println();
   for(j=0;j<6;j++){
    Serial.print(mode[i][j]);
    Serial.print("\t");
   }}
 
   for(i=0;i<16;i++){
   for(j=0;j<6;j++){
EEPROM.writeInt(address, mode[i][j]);
address+=2;
   }}
   address=0;
   for(i=0;i<16;i++){
   for(j=0;j<6;j++){
modeEEPROM[i][j]=EEPROM.readInt(address);
address+=2;
   }}
  Serial.println();
  Serial.println("The 2D Array has been read from EEPROM :"); 
  for(i=0;i<16;i++){
    Serial.println();
   for(j=0;j<6;j++){
    Serial.print(modeEEPROM[i][j]);
    Serial.print("\t");
   }} 


}

void loop(){}
Advertisements