Tutorial.ReadWrite History

Hide minor edits - Show changes to markup

January 16, 2012, at 03:11 PM by David Cuartielles -
Changed line 36 from:
to:
March 18, 2011, at 04:08 PM by Scott Fitzgerald -
Added lines 11-12:
  • Formatted SD card
March 16, 2011, at 05:33 PM by Scott Fitzgerald -
Changed lines 25-30 from:

In setup(), we create a new file with SD.open() named "test.txt". We also add a mode, FILE_WRITE. This allows us to read and write to the file, starting at the end. If a file "test.txt" was already on the card, that file would be opened. We've named the instance of the file "myFile".

Once opened, we use myFile.println() to write a string to the card, followed by a carriage return. Once the content is written, we close the file.

Again, we open the file with SD.open(). Once opened, we aske the Arduino to read the contents of the file with SD.read() and send them over the serial port. After all the contents of the file are read, we close the file with SD.close().

to:

In setup(), create a new file with SD.open() named "test.txt". FILE_WRITE enables read and write access to the file, starting at the end. If a file "test.txt" was already on the card, that file would be opened.

Name the instance of the opened file "myFile".

Once opened, use myFile.println() to write a string to the card, followed by a carriage return. Once the content is written, close the file.

Again, open the file with SD.open(). Once opened, ask the Arduino to read the contents of the file with SD.read() and send them over the serial port. After all the contents of the file are read, close the file with SD.close().

Changed lines 39-40 from:
to:
March 14, 2011, at 12:27 AM by Scott Fitzgerald -
Changed lines 29-32 from:

After checking to make sure the file exists with SD.exists(), we delete the file from the card with SD.remove.

to:

Again, we open the file with SD.open(). Once opened, we aske the Arduino to read the contents of the file with SD.read() and send them over the serial port. After all the contents of the file are read, we close the file with SD.close().

March 14, 2011, at 12:16 AM by Scott Fitzgerald -
Deleted line 8:
  • Three analog sensors
Changed lines 10-11 from:
  • SD card board
  • Breadboard or prototyping Board
to:
  • Ethernet Shield (or other board with an SD slot)
Changed lines 15-17 from:
to:
Changed lines 19-23 from:
to:

None, but the Arduino has to have the Ethernet Shield and a USB cable connected to the computer.

Changed lines 22-25 from:

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.

to:

Code

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 setup(), we create a new file with SD.open() named "test.txt". We also add a mode, FILE_WRITE. This allows us to read and write to the file, starting at the end. If a file "test.txt" was already on the card, that file would be opened. We've named the instance of the file "myFile".

Once opened, we use myFile.println() to write a string to the card, followed by a carriage return. Once the content is written, we close the file.

After checking to make sure the file exists with SD.exists(), we delete the file from the card with SD.remove.

February 24, 2011, at 12:27 AM by Scott Fitzgerald - Page Created
Added lines 1-39:

Share