Comments on: ESP8266 NodeMCU: Write Data to a File (LittleFS) – Arduino IDE https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 11 Aug 2025 20:34:37 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Tulio https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-1080906 Mon, 11 Aug 2025 20:34:37 +0000 https://randomnerdtutorials.com/?p=134008#comment-1080906 Hi! The sketch is looking great, and works too. I’m learning a lot thanks to you both. Thanks.

However, in this example:
I’m capable of writing into LittleFS,
I’m capable of reading that file in the serial monitor,

…but i’m not capable of reading the file and then import that read value into a variable.

I mean, I would love to do something with that number that i’m storing in: add it or substract it to something.

I just can’t get to assign that read value to a variable, other than display it in the serial monitor. I’ve tried almost everything.

file in LittleFS is called ‘zero’ and contains a random generated number, 10 charachters long (212677188, for example).

void readZero(){
File zeroFile = LittleFS.open(“/config/zero”,”r”);
if(!zeroFile){
return;
}
while(zeroFile.available()){
zero = zeroFile.read(); // zeroFile.read() tiene forma de entero!!!!!
//types(zeroFile.read()); //vartype test, expendable
return;
}
zeroFile.close();
}

I always get the assigned value to vue some two-digit value,most likely 49 and 50. Some other times i get error in trying to convert int into char.

What am I doing wrong?

Thanks again.

]]>
By: perv https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-877153 Mon, 11 Dec 2023 06:49:02 +0000 https://randomnerdtutorials.com/?p=134008#comment-877153 Hi Sara!
How to read variable “mydata” from the spiffs not as a string , but as an integer ?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-862682 Wed, 27 Sep 2023 09:17:13 +0000 https://randomnerdtutorials.com/?p=134008#comment-862682 In reply to Wim van der Hoeven.

Hi.
Check what is the chip of your ESP32 board. You probably can use other more generic board option.
Regards,
Sara

]]>
By: Wim van der Hoeven https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-862531 Tue, 26 Sep 2023 10:56:57 +0000 https://randomnerdtutorials.com/?p=134008#comment-862531 I have a new problem now, I use the TTGO LORa32 SX1276 Oled board called in your application TTGO LoRa32 SX1276 OLED Board: Getting Started with Arduino IDE

To get LittleFS running I have to update the Espressif library from version 1.0.6 to the latest version (2.0.13) but now I miss the reference to my board TTGO LORa32 SX1276 Oled

Now I reset the library back to version 1,0,6 to get my project working, but I can’t use LittleFS

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-862519 Tue, 26 Sep 2023 09:28:26 +0000 https://randomnerdtutorials.com/?p=134008#comment-862519 In reply to Maicon Gonzaga da Silva.

Reset the board two to three times and see if it mounts successfully.
Regards,
Sara

]]>
By: Maicon Gonzaga da Silva https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-862438 Mon, 25 Sep 2023 21:14:35 +0000 https://randomnerdtutorials.com/?p=134008#comment-862438 It didn’t work. returns LittleFS mount failed error without me having changed any of the code

]]>
By: Heni https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-862224 Sun, 24 Sep 2023 07:36:32 +0000 https://randomnerdtutorials.com/?p=134008#comment-862224 Thank you very much Sara for your helpful guide.
I want to ask if it’s possible to limit the text file in size to prevent being out of memory and overwrite the file when it reaches that size?
Thank you in advance

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-861932 Fri, 22 Sep 2023 09:46:42 +0000 https://randomnerdtutorials.com/?p=134008#comment-861932 In reply to fernado.

Gracias 🙂

]]>
By: fernado https://randomnerdtutorials.com/esp8266-nodemcu-write-data-littlefs-arduino/#comment-861881 Fri, 22 Sep 2023 04:56:46 +0000 https://randomnerdtutorials.com/?p=134008#comment-861881 Muy buen artículo lastima que no puedo comprar el libro

]]>