Qwiic OpenLog Hookup Guide
Arduino Sketches
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)
Note: Example 11 is useful if there is another I2C device that uses the same address. For example, the Qwiic OpenScale uses the same address (0x2A). You would need to configure the I2C address of either the Qwiic OpenLog or OpenScale.
For the scope of this tutorial, let's say you modified the address of the OpenLog using Example11_ChangeAddress.ino to0x1E
. To continue using the examples in the Qwiic OpenLog library, you will need to make sure to include the address as a parameter when making a connection to the OpenLog. The Qwiic OpenLog examples will default value of 0x2A if you do not provide an address. To include the new address you will need to change this function in thesetup()
function from:
To:myLog.begin(); //Open connection to OpenLog (no pun intended)
myLog.begin(0x1E); //Open connection to OpenLog (no pun intended)
- Valid I2C addresses are 0x08 to 0x77 (inclusive)