Skip to content

Commit dea0934

Browse files
committed
Update StringData.ino
1 parent bee7848 commit dea0934

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/StringData/StringData.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
AT24CM01 EEPROM; // Library
55

6-
#define TXTLEN 6 // String length
7-
char textarray[TXTLEN]; // text buffer
6+
#define AR_LEN 6 // Array length
7+
char textarray[AR_LEN]; // text buffer
88
String text = "Hello"; // string to be stored
99

1010
void setup()
@@ -15,15 +15,15 @@ void setup()
1515

1616
Serial.print("\n.................... Recalling String .................... \n");
1717
Serial.print("\n Writing << "); Serial.print(text);
18-
text.toCharArray(textarray, (TXTLEN)); // Use arduino to move String to text array
19-
EEPROM.writeCharArray(20, textarray, TXTLEN-1); // EEPROM.writeArrayType(address, array, arraysize)
18+
text.toCharArray(textarray, (AR_LEN)); // Use arduino to move String to text array
19+
EEPROM.writeCharArray(20, textarray, AR_LEN-1); // EEPROM.writeArrayType(address, array, arraysize)
2020

21-
memset(textarray, 0, TXTLEN-1); // Clear text array
21+
memset(textarray, 0, AR_LEN-1); // Clear text array
2222
text = ""; // Clear String
2323

24-
EEPROM.readCharArray(20, textarray, TXTLEN-1); // ReadArrayType(address, textarraybuffer, textsize)
24+
EEPROM.readCharArray(20, textarray, AR_LEN-1); // ReadArrayType(address, textarraybuffer, textsize)
2525
Serial.print("\n Recieved >> ");
26-
for(uint8_t x = 0; x < TXTLEN-1; x++)
26+
for(uint8_t x = 0; x < AR_LEN-1; x++)
2727
text += textarray[x]; // Add each array value to the string.
2828

2929
Serial.print(text); // Print string

0 commit comments

Comments
 (0)