I get every Second about 12 characters, something like "SD 0,05 g" upto "SD 1524,12 g".
So what i want is, to write every second the charaters in a Textfile data.
Whats my Problem? it doesn't even create a textfile
Cashan:
i read that i could use something like
myFile = SD.open("Text.txt", O_CREAT | O_WRITE | O_APPEND);
What does that actuall mean and why is it better? Why is there a line "|" instead of a comma ","?
In SD.h you will find:
#define FILE_WRITE (O_READ | O_WRITE | O_CREAT)
so the only difference is O_APPEND in place of O_READ. The "O_APPEND" says to add new data to the end of the file but that is also true of O_WRITE so it's not needed when O_WRITE is used.
If it is not creating the file and not appending to the file if it already exists then something is going wrong with the SD card. Try some of the SD library examples until you figure out why your file is not getting created.
I found the Error in my Code, but it's still not logging anything.
Can it be, that i cant get Serial Input with pin 0 and 1?
Can the command serial.read get input on Pin 1 and Pin 0 for Arduino nano?
Or is SERIAL_7E1 not possible?
Code to highlight things:
#include <SD.h>
File myFile;
const byte numChars = 32;
char receivedChars[numChars]; // an array to store the received data
boolean newData = false;
void setup() {
Serial.begin(2400, SERIAL_7E1);
pinMode(10, OUTPUT); //5V Reader Mirco-SD Breakout Board+ Output Pin
if (!SD.begin(10)); { //This ';' made my program to jump directly to return, instead of checking if the card is inserted.
return;
}
myFile = SD.open("Test.txt", FILE_WRITE);
myFile.println("Test Start");
myFile.close();
}