I am using a ESP8266 and am trying to read text from a text file to char array. Which works for a 255 char limit but I would like 350. My code looks like this.
char myChar[255];
void load()
{
for (char i = 0; i < 255; i = i + 1){
myChar[i] = myFile.read() ;
}
Serial.print(myChar);
}
I believe I can have an array as large at I want as long as I have ram for it, so I am most likely using the wrong array or setting up my array incorrectly.
so my text file is setup with a 25 character width and also does have \n at each line, would a 2d array work then. Say 25 char wide and 14 lines? that would give my my 350 characters. I am just wondering if there is a better way to do it.
So the 255 char array works well so far, I can call display.print(char) and get all the text. However to use all of the screen I want 350 characters.
I am thinking I need to do something like create a String of 25 characters which is one line of my text file then create an array of the 14 stings. this would give me my 350 characters
There is nothing preventing you from using a 350 element char array.
The for loop in your example will not work with i declared as char, because char is an unsigned 8-bit integer on an ESP8266 and can only hold values of 0 through 255. If you change i to an int the for loop will work with larger numbers.
I'm not familiar with eink displays, but a quick look at Adafruit's library would appear to indicate that you do not need to print the text as a single string, so you should be able to read and print one character at a time without storing it in memory.
thank you! I was sure I tried int for i but I guess not.
As far as I know for eink you need to load all the text in the frame buffer first then print to screen all at once which is what the GxEPD2 library does. Everything is working now. Thanks!