Hide minor edits - Show changes to markup
(:source http://github.com/arduino/Arduino/raw/master/libraries/SD/examples/Datalogger/Datalogger.pde lang=arduino tabwidth=4:)
(:source https://raw.github.com/arduino/Arduino/master/libraries/SD/examples/Datalogger/Datalogger.ino lang=arduino tabwidth=4:)
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup(), we call SD.begin(), naming pin 4 as the CS pin. This pin varies depending on the make of shield or board.
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup(), call SD.begin(), naming pin 4 as the CS pin. This pin varies depending on the make of shield or board.
(:include SDLibrarySeeAlsoIncludes :)
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup(), we call SD.begin(), naming pin 4 as the CS pin. This pin varies depending on the make of shield or board you are using.
In the loop(), a String is created to hold the information from three analog sensors. We iterate through the sensors, adding their data to the string.
Next, we open the file on the SD card using SD.open(). Once available, we write the data and close it to save the information.
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup(), we call SD.begin(), naming pin 4 as the CS pin. This pin varies depending on the make of shield or board.
In the 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.
(:div class=circuit :)

(:divend:)
In the code below, the Arduino starts out by setting the SCP1000's configuration registers in the setup(). In the main loop,it sets the sensor to read in high resolution mode, meaning that it will return a 19-bit value for the pressure reading, and 16 bits for the temperature. The actual reading in degrees Celsius is the 16-bit result divided by 20.
Then it reads the temperature's two bytes. Once it's got the temperature, it reads the pressure in two parts. First it reads the highest three bits, then the lower 16 bits. It combines these two into one single long integer by bit shifting the high bits then using a bitwise OR to combine them with the lower 16 bits. The actual humidity in Pascals is the 19-bit result divide by 4.
The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup(), we call SD.begin(), naming pin 4 as the CS pin. This pin varies depending on the make of shield or board you are using.
In the loop(), a String is created to hold the information from three analog sensors. We iterate through the sensors, adding their data to the string.
Next, we open the file on the SD card using SD.open(). Once available, we write the data and close it to save the information.
Examples > SD Datalogger
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.
(:div class=BOM :)
(:divend:)
(:div class=circuit :)
image developed using Fritzing. For more circuit examples, see the Fritzing project page
(:divend:)
(:div class=circuit :)

(:divend:)
In the code below, the Arduino starts out by setting the SCP1000's configuration registers in the setup(). In the main loop,it sets the sensor to read in high resolution mode, meaning that it will return a 19-bit value for the pressure reading, and 16 bits for the temperature. The actual reading in degrees Celsius is the 16-bit result divided by 20.
Then it reads the temperature's two bytes. Once it's got the temperature, it reads the pressure in two parts. First it reads the highest three bits, then the lower 16 bits. It combines these two into one single long integer by bit shifting the high bits then using a bitwise OR to combine them with the lower 16 bits. The actual humidity in Pascals is the 19-bit result divide by 4.
(:div class=code :) (:source http://github.com/arduino/Arduino/raw/master/libraries/SD/examples/Datalogger/Datalogger.pde lang=arduino tabwidth=4:) (:divend:)