I was trying to measure a thermistor over a long period of time (months) and wanted to save the data to a file. However, I did not want one huge file, so I was going to get the month and day, and automatically create a directory /month/day/temperature.dat file daily to record the data. However, I had no idea how to get the date and found the time.h library but have had problems.
I wrote the following code after following the instructions at the site
http://playground.arduino.cc/Code/Time
I imported the time library and then loaded the library into the sketch under sketch->import library->time.
#include <Time.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
However, when I verify the sketch, I get the following errors:
Arduino: 1.5.7 (Windows 7), Board: "Arduino Uno"
Build options changed, rebuilding all
In file included from C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:10:0:
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:18:18: error: variable 'monthStr1' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr1[] PROGMEM = "January";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:19:18: error: variable 'monthStr2' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr2[] PROGMEM = "February";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:20:18: error: variable 'monthStr3' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr3[] PROGMEM = "March";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:21:18: error: variable 'monthStr4' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr4[] PROGMEM = "April";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:22:18: error: variable 'monthStr5' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr5[] PROGMEM = "May";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:23:18: error: variable 'monthStr6' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr6[] PROGMEM = "June";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:24:18: error: variable 'monthStr7' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr7[] PROGMEM = "July";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:25:18: error: variable 'monthStr8' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr8[] PROGMEM = "August";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:26:18: error: variable 'monthStr9' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr9[] PROGMEM = "September";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:27:19: error: variable 'monthStr10' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr10[] PROGMEM = "October";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:28:19: error: variable 'monthStr11' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr11[] PROGMEM = "November";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:29:19: error: variable 'monthStr12' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthStr12[] PROGMEM = "December";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:31:22: error: variable 'monthNames_P' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PGM_P monthNames_P[] PROGMEM =
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:37:26: error: variable 'monthShortNames_P' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char monthShortNames_P[] PROGMEM = "ErrJanFebMarAprMayJunJulAugSepOctNovDec";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:39:16: error: variable 'dayStr0' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr0[] PROGMEM = "Err";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:40:16: error: variable 'dayStr1' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr1[] PROGMEM = "Sunday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:41:16: error: variable 'dayStr2' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr2[] PROGMEM = "Monday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:42:16: error: variable 'dayStr3' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr3[] PROGMEM = "Tuesday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:43:16: error: variable 'dayStr4' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr4[] PROGMEM = "Wednesday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:44:16: error: variable 'dayStr5' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr5[] PROGMEM = "Thursday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:45:16: error: variable 'dayStr6' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr6[] PROGMEM = "Friday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:46:16: error: variable 'dayStr7' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayStr7[] PROGMEM = "Saturday";
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:48:20: error: variable 'dayNames_P' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PGM_P dayNames_P[] PROGMEM = { dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7};
^
C:\Users\Michael\Documents\Arduino\libraries\Time\DateStrings.cpp:49:24: error: variable 'dayShortNames_P' must be const in order to be put into read-only section by means of 'attribute((progmem))'
char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThrFriSat";
^This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Okay, so I am wondering if the errors I am seeing are due to my IDE version, the time library, or something else? Obviously, I have been battling this for a while, not sure what I am doing wrong. Open to ideas.