Skip to main content
AKh.1
Associate II
Jan 18, 2021 10:51 PM UTC
Solved

Logging a Variable Using USB Mass Storage Mode

Hi guys,

On USB Host Mass storage mode, I am creating a text file using (f_open(&myFile, "TEST2.TXT", FA_WRITE | FA_CREATE_ALWAYS function.

For writing text into the file, I use sprintf(rwtext, "Hello World"); function to write the text into the txt file.

Now, What function should I use if I want to log a "variable" that is changing from time to time and write it as a text in a txt file? (Like, X is an input voltage that's changing frequently, and I would like to log this voltage value and save it in a column as txt file in ).

Any help is highly appreciated on this.

This topic has been closed for replies.
TDK
TDKBest answer
Jan 19, 2021 1:01 AM UTC

The typical way is to use sprintf to print the variable to a local string buffer, and then send that buffer to the SD card.

"If you feel a post has answered your question, please click ""Accept as Solution""."

1 reply

TDK
TDKBest answer
Jan 19, 2021 1:01 AM UTC

The typical way is to use sprintf to print the variable to a local string buffer, and then send that buffer to the SD card.

"If you feel a post has answered your question, please click ""Accept as Solution""."