I am using an Arduino UNO.
I am building a RTC that can be set with two push buttons (Pin 2 & 3 using pull-up resistors for low level logic) and this is used with a data logger.
I am using a DS3231 RTC and a MicroSD Card Adapter for the data logger.
I want to use the RTC program that I snipped from the internet. The RTC works well. I want to be able to set the clock later for daylight savings time without re-uploading the time change using the computer.
I also have included a K thermocouple analog sensor to A0.
I want to be able to data log and time stamp onto a micro SanDisk the date, time, and temperature when I make Pin 4 HIGH. I just want one line of data to be logged to the disk each time Pin 4 goes HIGH.
I have combined this RTC code again with Data Logging code that I have snipped from the internet.
I can get the serial communication with the serial monitor and it is printing the date, time and temperature in both C and F every second.
The problem I am having is that the data logger program uses a #define ECHO_TO FILE 0 and #define ECHO_TO_SERIAL 1 in the declaration at the top of the program before void setup(). The program will display the date and time and temp both C & F to the serial monitor. But when I change #define ECHO_TO_FILE 1, I get a compiling “Copy error message” conflicting declaration ‘byte second’. This occurs at line (byte i, second, minute, hour, day, date, month, year; which occurs under void setup () of the RTC code.
I cannot determine if I can get the data logger to work without being able to change #define ECHO_TO FILE 1.
I cannot get a timestamp to the data logger without ECHO_TO_FILE being set to 1.
Is there a code fix for this so that I can log on one line the date time and temperature C & F to teh data logger San Disk every time Pin 4 goes high.
I think I am close, but cannot seem to get past the above issue.
I would appreciate any help or suggestions to my code attached.
RTC_w_DATA_Logger_sketch.ino (11.1 KB)