Qwiic OpenLog Hookup Guide

Pages
Contributors: Nate, Toni_K, Ell C, Englandsaurus
Favorited Favorite 0

Arduino Sketches

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.
Note: The Qwiic OpenLog utilizes clock stretching, which some I2C master devices like ESP32 can't handle. To avoid this, you may have to only send/read bytes one at a time to receive proper data.

There are eleven examples in the Qwiic OpenLog Arduino Library that can be used when connected to a Qwiic OpenLog. These Arduino functions replace the serial command communication that occurred on the previous version of the OpenLog. These example files are named such that their functions should be self-explanatory, but in case you want more information, see the descriptions below. The easiest way to install the library is by searching SparkFun Qwiic OpenLog is within the Arduino library manager. To manually install, head on over to the GitHub Page or feel free to download the library here!

  • Example1_WritingLog -- This example shows how to record various text and variables to Qwiic OpenLog.

  • Example2_AppendFile -- Arduino sketch showing how to append text to the end of File. If File does not exist when this function is called, the file will be created.

  • Example3_CreateFile -- This example shows how to create a new file named File in the current directory. Standard 8.3 filenames are supported. For example, "87654321.123" is acceptable, while "987654321.123" is not.

  • Example4_ReadFileSize -- This example shows how to record some strings to a default log, check the size of a given file name, and if the given file doesn't exist, say so.

  • Example5_ReadFile -- This example shows how to record some strings to a default log, check the size of a given file name, if that given file doesn't exist, create it with random characters, and read back the contents of the given file (containing random characters)

  • Example6_MakeDirectory -- This example shows how to create a directory, move into that directory called MONDAY, create a sub directory within MONDAY called LOGS, and create and write to a file inside MONDAY.

  • Example7_ReadDirectoryContents -- This example shows how to read the files in a given directory. You can use wildcards if desired. This is handy for listing a certain type of file such as .LOG or LOG01.TXT.

  • Example8_RemoveDirectory -- This example shows how to create a directory, create some files there, delete a specific file, delete *.TXT, and remove the directory we created.

  • Example9_ReadVersion -- This example shows how to read the firmware version of Qwiic OpenLog.

  • Example10_CheckStatus -- This example shows how to read the status byte of the OpenLog.

  • Example11_ChangeAddress -- This example shows how to change the I2C address of the Qwiic OpenLog from the default address 0x2A to 0x1E (or 42 and 30 in decimal, respectively. It's easy to change the I2C address. If you forget what the address is you can use the I2CScanner Example to re-discover it. You can also close the ADR jumper on the board. This will force the I2C address to 0x29 regardless of any other setting or command.

    • Valid I2C addresses are 0x08 to 0x77 (inclusive)