https://www.jeremyblum.com/2011/04/05/tutorial-11-for-arduino-sd-cards-and-datalogging/
Tutorial 11 for Arduino: SD Cards and Datalogging