This is my code to Read/Write to a SD Card. OK not mine but adapted from the Example !! I have used Serial1. What I expect :
1. The T3.5 is powered via the USB port.
2. The Serial1 is connected to a Terminal on the same PC via another USB port.
3. I RESET the T3.5 by connecting the Reset pin to 3.3V momentarily.
4. I expect the code to run and tell me what it did over the Serial1 port.
5. But nothing happens. What am i missing ? This is very different from UNO experience. ( In fact with T3.5 the ReBoot button on the downloader is always disabled )
I know i am missing something basic -- need to know which !
1. The T3.5 is powered via the USB port.
2. The Serial1 is connected to a Terminal on the same PC via another USB port.
3. I RESET the T3.5 by connecting the Reset pin to 3.3V momentarily.
4. I expect the code to run and tell me what it did over the Serial1 port.
5. But nothing happens. What am i missing ? This is very different from UNO experience. ( In fact with T3.5 the ReBoot button on the downloader is always disabled )
I know i am missing something basic -- need to know which !
Code:
#include <SD.h>
#include <SPI.h>
File myFile;
const int chipSelect = BUILTIN_SDCARD;
void setup()
{
Serial1.begin(9600);
Serial1.print("Initializing SD card...");
if (!SD.begin(chipSelect))
{
Serial1.println("initialization failed!");
return;
}
Serial1.println("initialization done.");
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile)
{
Serial1.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
myFile.close(); // Only now the actual Write to SDC happens
Serial1.println("done.");
} else {
Serial1.println("error opening test.txt");
}
myFile = SD.open("test.txt"); // re-open the file for reading:
if (myFile) {
Serial1.println("test.txt:");
while (myFile.available())
{
Serial1.write(myFile.read());
}
myFile.close();
}
else
{
Serial1.println("error opening test.txt"); // if the file didn't open, print an error:
}
}
void loop()
{
// nothing happens after setup
}