Hi, this is my first post so please forgive, but ive been having a problem with using the SD library with the teensy 3.6. Here is the code
#include <SD.h>
#include <SPI.h>
int chipSelect = BUILTIN_SDCARD;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
while (1) {
// No SD card, so don't do anything more - stay stuck here
}
}
}
void loop() {
// put your main code here, to run repeatedly:
File dataFile = SD.open("Hello_World.txt", FILE_WRITE);
if (dataFile) {
dataFile.print("Hello World");
dataFile.close();
Serial.print("Data Transferred ");
} else {
// if the file isn't open, pop up an error:
Serial.println("error opening Hello_World.txt");
}
delay(5);
}
My error is that BUILTIN_SDCARD was not declared in this scope. Can someone tell me what I am doing wrong?
Thanks
#include <SD.h>
#include <SPI.h>
int chipSelect = BUILTIN_SDCARD;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
while (1) {
// No SD card, so don't do anything more - stay stuck here
}
}
}
void loop() {
// put your main code here, to run repeatedly:
File dataFile = SD.open("Hello_World.txt", FILE_WRITE);
if (dataFile) {
dataFile.print("Hello World");
dataFile.close();
Serial.print("Data Transferred ");
} else {
// if the file isn't open, pop up an error:
Serial.println("error opening Hello_World.txt");
}
delay(5);
}
My error is that BUILTIN_SDCARD was not declared in this scope. Can someone tell me what I am doing wrong?
Thanks