Code
Code
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <SoftwareSerial.h>
#include <EEPROM.h>
#define PIN 6
#define EEPROM_MIN_ADDR 0
#define EEPROM_MAX_ADDR 100
#define LEN 450
void setup() {
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(150);
matrix.setTextColor(colors[0]);
randomSeed(analogRead(0));
BTserial.begin(9600);
//Serial.begin(9600);
char chararray[LEN];
if (eeprom_read_string(10, chararray, LEN)) {
//Serial.println(chararray);
in = chararray;
}
}
void loop() {
if (BTserial.available() > 0) {
in = BTserial.readString();
char temparray[in.length() + 1];
in.toCharArray(temparray, in.length() + 1);
if (strstr(temparray, "#") != NULL) {
in = strstr(temparray, "#") + 1;
char temp[in.length() + 1];
in.toCharArray(temp, in.length() + 1);
eeprom_write_string(10, temp);
}
else {
in = defaultText;
char temp[in.length() + 1];
in.toCharArray(temp, in.length() + 1);
eeprom_write_string(10, temp);
}
}
text(random(6));
ptr = (byte*)&value;
return eeprom_write_bytes(addr, ptr, sizeof(value));
}
//Returns True if the specified address is between the minimum and the maximum
allowed range.
//Invoked by other superordinate functions to avoid errors.
boolean eeprom_is_addr_ok(int addr) {
return ((addr >= EEPROM_MIN_ADDR) && (addr <= EEPROM_MAX_ADDR));
}
if (bufSize == 1) {
buffer[0] = 0;
return true;
}
bytesRead = 0;
ch = EEPROM.read(addr + bytesRead);
buffer[bytesRead] = ch;
bytesRead++;
while ((ch != 0x00) && (bytesRead < bufSize) && ((addr + bytesRead) <=
EEPROM_MAX_ADDR)) {
ch = EEPROM.read(addr + bytesRead);
buffer[bytesRead] = ch;
bytesRead++;
}
return true;
}