Hello,
I am working on a small arduino project to read a temp sensor in a bee hive and record it on a sd card, Im currently just trying to create a file and save text, then adding on from there. I have done multiple of the examples from the SD library and they seem to work fine reading and writing to the sd card. I think i am just missing something small. Here is my code to look at.
thanks
#include <SPI.h>
#include <SD.h>
File myfile;
const int chipSelect = 10;
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
myfile = SD.open("hivemonitor.txt", FILE_WRITE);
if (myfile) {
Serial.print("hello World");
myfile.println("hello World");
myfile.close();
Serial.println("done");
}
else { Serial.println("error opening hivemonitor.txt");
}
}
void loop() { }