User Manual

8
Reading and writing data onto the microSD card
The SD library provides useful functions which allows to easily write onto and read from an
SD card. Open the ReadWrite example from File Examples SD ReadWrite and upload
it to your Arduino
®
Uno board.
Code
1.
/*
2.
SD card read/write
3.
4.
This example shows how to read and write data to and from an SD card file
5.
The circuit:
6.
SD card attached to SPI bus as follows:
7.
** MOSI - pin 11
8.
** MISO - pin 12
9.
** CLK - pin 13
10.
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)
11.
12.
created Nov 2010
13.
by David A. Mellis
14.
modified 9 Apr 2012
15.
by Tom Igoe
16.
17.
This example code is in the public domain.
18.
19.
*/
20.
21.
#include <SPI.h>
22.
#include <SD.h>
23.
24.
File myFile;
25.
26.
void setup() {
27.
// Open serial communications and wait for port to open: