Once you have your Feather working, you probably want to rock out with some SD card reading and writing! Luckily, the Arduino IDE has an SD card library that works great, and it even comes with the IDE!
You can start with CardInfo which is very detailed
Luckily many of the default examples already have chipSelect = 4 For other sketches, do check to make sure that CS is set to 4! The SD card uses hardware SPI for the remaining pins.
Make sure you have Adafruit SAMD board package version 1.6.2 or higher, so that Serial debug data goes out on Serial not SerialUSB!
One done, upload & open up the serial console and you'll get all this info including a list of files
Note that it may not print out the files, thats because the example root.ls(LS_R | LS_DATE | LS_SIZE) expects to print to Serial rather than SerialUSB.
If you want to list the files, use listFiles example
Once you have that working, check out the other examples, such the Datalogger example (saving analog data to SD card) and Dumpfile example (reading back data from an SD card)
Example logging sketch
If you want to try saving data to the SD card in the simplest sketch, try this example. You can adjust the delay() to set how often analog data is read from pin A0 and saved to the SD card. The red LED will blink if there's an error, and the green LED will blink when data is written to the SD card.
Note that to save power, we buffer the data, so you will only 'save' data truely every 50 datapoints (512 total characters written)
If you really want to make sure you save every data point, put a
logfile.flush();
right after the logfile.print's however this will cause the adalogger to draw a log more power, maybe about 3x as much on average (30mA avg rather than about 10mA)
Next steps!
Once you know the SD card works, check out the SD card library examples, SD library documentation and Notes!
Text editor powered by tinymce.