This example shows how to use the SD card Library to log data from three analog sensors to a SD card. Please click here for more information on the SD library.
The Arduino or Genuino board has to be connected to the Ethernet Shield. The three potentiometers may be substituted with other analog sensors, to be wired according to their interfacing techniques.
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the
SD.begin(), naming pin 4 as the CS pin. This pin varies depending on the make of shield or board.
loop(), a String is created to hold the information from three analog sensors. The code iterates through the sensors, adding their data to the string.
Next, the file on the SD card is opened by calling
SD.open(). Once available, the data is written to the card when
dataFile.println() is used. The file must be closed with
dataFile.close() to save the information.
Last revision 2015/08/17 by SM