updating again

This commit is contained in:
Liz 2023-08-14 09:04:32 -04:00
parent 329a3c9c3f
commit c8035738b4

View file

@ -22,15 +22,15 @@
*/ */
#include <SPI.h> #include "SdFat.h"
#include <SD.h> SdFat sd;
#define SD_FAT_TYPE 3 #define SD_FAT_TYPE 1
// default CS pin is 23 for Metro RP2040 // default CS pin is 23 for Metro RP2040
#define SD_CS_PIN 23 #define SD_CS_PIN 23
File myFile; File32 myFile;
void setup() { void setup() {
// Open serial communications and wait for port to open: // Open serial communications and wait for port to open:
@ -42,7 +42,7 @@ void setup() {
Serial.print("Initializing SD card..."); Serial.print("Initializing SD card...");
if (!SD.begin(SD_CS_PIN)) { if (!sd.begin(SD_CS_PIN)) {
Serial.println("initialization failed!"); Serial.println("initialization failed!");
return; return;
} }
@ -50,7 +50,7 @@ void setup() {
// open the file. note that only one file can be open at a time, // open the file. note that only one file can be open at a time,
// so you have to close this one before opening another. // so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE); myFile.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it: // if the file opened okay, write to it:
if (myFile) { if (myFile) {
@ -66,7 +66,7 @@ void setup() {
} }
// re-open the file for reading: // re-open the file for reading:
myFile = SD.open("test.txt"); myFile.open("test.txt");
if (myFile) { if (myFile) {
Serial.println("test.txt:"); Serial.println("test.txt:");