Skip to main content
Visitor II
January 18, 2021
Solved

Logging a Variable Using USB Mass Storage Mode

  • January 18, 2021
  • 1 reply
  • 726 views

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.
    Best answer by TDK

    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.

    1 reply

    TDKAnswer
    Super User
    January 19, 2021

    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.