This chapter discusses the following functions of the SD library:

  • begin()
  • open()
  • exists()
  • close()
  • read()
  • peek()
  • position()
  • seek()
  • size()
  • available()
  • print()
  • println()
  • write()
  • mkdir()
  • rmdir()
  • flush()
  • isFolder()

The hardware needed to run the examples in this chapter includes:

  • Arduino Uno
  • Ethernet shield (Arduino, SainSmart, or similar board)
  • Micro-SD Card

You can find the code download for this chapter at on the Download Code tab. The code is in the Chapter 12 download folder and the filename is Chapter12.ino.


The hunger for storage has increased exponentially. Early computers did not have hard drives; the operating system and applications were stored on a floppy disk. The first commercially available floppy disk was an 8-inch disk, which became available in 1971. It could store an enormous 175 KB of data. In 1976, the standard became 5 ¼ inch (ironically known as the minifloppy). The original model could store 87.5 KB, but newer models could store more than 1 megabyte. The large slots on your desktop computer that house a DVD drive or Blu-ray drive are that size because of floppy disks; the size of the minifloppy disk drive became standard.

As technology advanced, so did the storage capacity of disks, and 5 ¼-inch disks were considered too big; the computer industry turned to 3 ½-inch floppies, known as micro-floppies. Early models could store 360 KB, but later models could either be single density (720 KB) or ...

Get Arduino Sketches: Tools and Techniques for Programming Wizardry now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.