Product Overview
1/29/2018 ESP32 Thing Motion Shield Hookup Guide - learn.sparkfun.com
https://learn.sparkfun.com/tutorials/esp32-thing-motion-shield-hookup-guide?_ga=2.240586115.1022152466.1517244327-204410570.1509632255 10/17
(this example plus code and header)
from https://github.com/sparkfun/ESP32_Motion_Shield/tree/master/Software/FileSerialExample.
In addition to standard methods such as print() and println() , the library includes the following functionality.
Construction
Create a file writing object with the class name FileSerial. You can construct in two ways:
FileSerial ExampleFileSet(&Serial); – Verbose output of data/File IO status to passed serial object.
FileSerial ExampleFileSet; – Non-verbose.
begin();
int begin(fs::FS * inputDevice, uint8_t ssPin, SPIClass &spi, uint32_t frequency, const char * mountpoint);
Call begin to mount the card and start the SPI device.
Pass: device, CS pin, port, frequency, and mount point.
Returns: 1 if success.
Example: ExampleFileSet.begin(&SD, 33, SPI, 10000000, "/sd")
Using Multiple FileSerial Instances: Calling .begin checks if another FileSerial object has already mounted the
card. If so, it doesn't re-initialize the microSD card, so multiple files can be written simultaneously. They can
even have different paths.
setMaxFileSize();
void setMaxFileSize( int32_t inputSize );
Call to set the max file size in bytes.
Default: 250kB
Range:
0 – No cap.
32 to 1000000000 – 32 bytes to 1GB
setWriteBufferSize();
void setWriteBufferSize( uint8_t inputSize );
Call to set buffer size in bytes before performing file write.
Default: 100B
Range: 1 to 255 – 1B to 255B
startLog()
int startLog( const char * inputPath, const char * inputStub );
Start a batch of log files. Pass directory name and file name. The file name will be appended with nnnn.txt where
“nnnn” are sequential numbers.
If directory is a path, parent directories must exist!
“[existing directory]/[new directory]” is valid
“[new directory]/[new directory]” is not
Example: ExampleFileSet.startLog("testFiles", "file");