I didn't know where to bring up my problem so i came here.
I am using this code to write the data i get from analog input on an SD card.
file.open(file_name, ios::app | ios::out);
file << _hour << ':' << _minute << ':' << _second;
file << " " << "sensor " << analog_counter << " : ";
file << analog_input(analog_counter) << endl;
as you may see file is an instance of ofstream and analog_input is the data which is read from analog pins. I have a DS1307 which gives me the real time and i get _hour and _minute and _second from that.
i use this code as a function and call it whenever i need it which is pretty much more than 50 times a second i think.
I don't see why, but i keep receiving the error codes on my LCD.
file_name is the date like 20130716.txt.
I use this function to open the file and append to it. i have another function to make the file_name and make another file for me in case day or month or year have changed.
for (byte i=0;i<4;i++) file_name[i]=name1[i];
if (sd.exists(file_name)) return;
logfile.open(file_name, ios::app | ios::out);
logfile << "some text1" << endl;
logfile << "some text2" << endl;
logfile << "some text3" <<endl;
i use this code to make another file. at first run this code works pretty fine and makes me a file. but when i change date and call this function i start getting the error codes i have defined on LCD and no file is made for me. when i reset the arduino it make me my new file because the date that i have changed stays in DS1307.
can anyone make any sense of this program and tell me what i have done wrong?
any help is greatly appreciated.