// Open serial communications and wait for port to open: | // Open serial communications and wait for port to open: | ||||
Serial.begin(9600); | Serial.begin(9600); | ||||
while (!Serial) { | while (!Serial) { | ||||
; // wait for serial port to connect. Needed for Leonardo only | |||||
; // wait for serial port to connect. | |||||
} | } | ||||
// Open serial communications and wait for port to open: | // Open serial communications and wait for port to open: | ||||
Serial.begin(9600); | Serial.begin(9600); | ||||
while (!Serial) { | while (!Serial) { | ||||
; // wait for serial port to connect. Needed for Leonardo only | |||||
; // wait for serial port to connect. | |||||
} | } | ||||
} | } | ||||
} | } | ||||
// open the file. note that only one file can be open at a time, | |||||
// so you have to close this one before opening another. | |||||
// open the file. | |||||
File dataFile = SD.open("datalog.txt", FILE_WRITE); | File dataFile = SD.open("datalog.txt", FILE_WRITE); | ||||
// if the file is available, write to it: | // if the file is available, write to it: |
// Open serial communications and wait for port to open: | // Open serial communications and wait for port to open: | ||||
Serial.begin(9600); | Serial.begin(9600); | ||||
while (!Serial) { | while (!Serial) { | ||||
; // wait for serial port to connect. Needed for Leonardo only | |||||
; // wait for serial port to connect. | |||||
} | } | ||||
} | } | ||||
Serial.println("card initialized."); | Serial.println("card initialized."); | ||||
// open the file. note that only one file can be open at a time, | |||||
// so you have to close this one before opening another. | |||||
// open the file. | |||||
File dataFile = SD.open("datalog.txt"); | File dataFile = SD.open("datalog.txt"); | ||||
// if the file is available, write to it: | // if the file is available, write to it: |
// Open serial communications and wait for port to open: | // Open serial communications and wait for port to open: | ||||
Serial.begin(9600); | Serial.begin(9600); | ||||
while (!Serial) { | while (!Serial) { | ||||
; // wait for serial port to connect. Needed for Leonardo only | |||||
; // wait for serial port to connect. | |||||
} | } | ||||
// Open serial communications and wait for port to open: | // Open serial communications and wait for port to open: | ||||
Serial.begin(9600); | Serial.begin(9600); | ||||
while (!Serial) { | while (!Serial) { | ||||
; // wait for serial port to connect. Needed for Leonardo only | |||||
; // wait for serial port to connect. | |||||
} | } | ||||
// Open serial communications and wait for port to open: | // Open serial communications and wait for port to open: | ||||
Serial.begin(9600); | Serial.begin(9600); | ||||
while (!Serial) { | while (!Serial) { | ||||
; // wait for serial port to connect. Needed for Leonardo only | |||||
; // wait for serial port to connect. | |||||
} | } | ||||