Browse Source

Cosmetic improvements in CopyFromSD example

main
PaulStoffregen 9 years ago
parent
commit
eab1268ead
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      examples/CopyFromSD/CopyFromSD.ino

+ 9
- 3
examples/CopyFromSD/CopyFromSD.ino View File

#include <SD.h> #include <SD.h>
#include <SPI.h> #include <SPI.h>


const int SDchipSelect = 4;
const int SDchipSelect = 4; // Audio Shield has SD card CS on pin 10
const int FlashChipSelect = 6; const int FlashChipSelect = 6;


void setup() { void setup() {
Serial.print(" copying"); Serial.print(" copying");
// copy data loop // copy data loop
unsigned long count = 0; unsigned long count = 0;
unsigned char dotcount = 9;
while (count < length) { while (count < length) {
char buf[256]; char buf[256];
unsigned int n; unsigned int n;
ff.write(buf, n); ff.write(buf, n);
count = count + n; count = count + n;
Serial.print("."); Serial.print(".");
if (++dotcount > 100) {
Serial.println();
dotcount = 0;
}
} }
ff.close(); ff.close();
Serial.println();
if (dotcount > 0) Serial.println();
} else { } else {
Serial.println(" error opening freshly created file!"); Serial.println(" error opening freshly created file!");
} }
f.close(); f.close();
} }
rootdir.close(); rootdir.close();

delay(10);
Serial.println("Finished All Files");
} }





Loading…
Cancel
Save