I was trying to interface my A. Uno with SD Card break out but the problem exist when I tried to compile/upload to uno. This are the compilling error
Arduino: 1.5.7 (Windows 7), Board: "Arduino Uno"
In file included from C:\Program Files (x86)\Arduino\libraries\SdFat/SdFat.h:26:0,
- from sketch_sep24a.ino:1:*
C:\Program Files (x86)\Arduino\libraries\SdFat/SdStream.h:27:92: fatal error: WProgram.h: No such file or directory
#include <WProgram.h>////////////////////////////////////////////////////////////////////// - ^*
compilation terminated.
I already added the library which is SdFat. Already tried including #include <WProgram.h> and #include <Arduino.h> still the same problem exist.
The coding
#include <SdFat.h>
// file system object
SdFat sd;
// create Serial stream
ArduinoOutStream cout(Serial);
// store error strings in flash to save RAM
#define error(s) sd.errorHalt_P(PSTR(s))
//------------------------------------------------------------------------------
void setup() {
// filename for this example
char name[] = "APPEND.TXT";
Serial.begin(9600);
// pstr() stores strings in flash to save RAM
cout << endl << pstr("Type any character to start\n");
while (!Serial.available());
// initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
// breadboards. use SPI_FULL_SPEED for better performance.
if (!sd.init(SPI_HALF_SPEED)) sd.initErrorHalt();
cout << pstr("Appending to: ") << name;
for (uint8_t i = 0; i < 100; i++) {
// open stream for append
ofstream sdout(name, ios::out | ios::app);
if (!sdout) error("open failed");
// append 100 lines to the file
for (uint8_t j = 0; j < 100; j++) {
// use int() so byte will print as decimal number
sdout << "line " << int(j) << " of pass " << int(i);
sdout << " millis = " << millis() << endl;
}
// close the stream
sdout.close();
if (!sdout) error("append data failed");
if (i % 25 == 0) cout << endl;
cout << '.';
}
cout << endl << "Done" << endl;
}
//------------------------------------------------------------------------------
void loop() {}