Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SD.h>
- #include <SPI.h>
- void setup(){
- SPI.setClockDivider(SPI_CLOCK_DIV4);
- Serial.begin(9600);
- pinMode(10, OUTPUT);
- SD.begin(4);
- SD.remove("myFile.bin");
- File myFile = SD.open("myFile.bin", FILE_WRITE);
- if(! myFile){
- Serial.println("Failed to open file for writing");
- return;
- }
- byte * data = new byte[128];
- for(int a = 0; a < 128; a++){
- data[a] = 0x00;
- }
- long start = millis();
- for(unsigned long a = 0; a < 1024L * 8L * 1L; a++){
- myFile.write(data, 128);
- }
- long ending = millis();
- myFile.close();
- Serial.print("Took ");
- Serial.print((ending - start) / 1000);
- Serial.println(" seconds to write the data");
- }
- void loop(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement