Last active
September 4, 2022 17:04
-
-
Save Tech500/f52973764b0ae4c16c9ec64a9dcf6619 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Fuction to read all lines of a text file line by line; then on selected an array element print | |
the selected array elemment. Coding help from Pauljujo of Random Nerd Tutorials Lab Forum. | |
09/04/2022 Code by Pauljujo and William Lucid | |
void readWord(){ | |
// Open a "wordfile.txt" for reading | |
File word = LittleFS.open("/wordfile.txt", "r"); //input words from "wordfile.txt" | |
if (! word){ | |
Serial.println("File 'wordfile.txt' open failed"); | |
} | |
while(word.available()) { | |
for (list_Word = 0; list_Word < 10; list_Word++) { | |
inputWord[list_Word] = word.readStringUntil('\n'); //Read line until newline | |
Serial.println(inputWord[list_Word]); | |
} | |
} | |
word.close(); | |
Serial.println(""); | |
Serial.println(inputWord[3]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment