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 so you can just upload immediately. For other sketches, do check to make sure that CS is set to 4! The SD card uses hardware SPI for the remaining pins.

Anyhow, open up the serial console and you'll get all this info including a list of files

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)

https://gist.github.com/ladyada/13efab4022b7358033c7

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 lot more power, maybe about 3x as much on average (30mA avg rather than about 10mA)

This guide was first published on Nov 11, 2015. It was last updated on Nov 11, 2015.

This page (Using the SD Card) was last updated on Nov 11, 2015.

Text editor powered by tinymce.