I'm probably asking a question that occurs time and time again - so my apologies.
I have a DS3231 RTC module. I think I am using code from ladyada but I'm not certain of that, however I have programmed the RTC successfully and modified the code so the print out reads Weekday, Date, Month, Year, Hour, Minute and Second.
The weekday comes from the RTC as a number - 1 to 7 - I can convert that to the day name with 'if' statements but I believe there is a neater way using what I remember as 'string slicing'. I have tried the following from Arduino Reference but it doesn't cut the mustard.
75 char* weekday[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday";}
Verifying the sketch with the above line commented out brings no objection but when I uncomment it I get:
RTC_1_v2.ino: In function 'void printDate()':
RTC_1_v2:75: error: expected `}' before ';' token
RTC_1_v2:75: error: scalar object 'weekday' requires one element in initializer
RTC_1_v2.ino:67: warning: unused variable 'second'
RTC_1_v2.ino:68: warning: unused variable 'minute'
RTC_1_v2.ino:69: warning: unused variable 'hour'
RTC_1_v2.ino:70: warning: unused variable 'day'
RTC_1_v2.ino:71: warning: unused variable 'date'
RTC_1_v2.ino:72: warning: unused variable 'month'
RTC_1_v2.ino:73: warning: unused variable 'year'
RTC_1_v2.ino:75: warning: unused variable 'weekday'
RTC_1_v2.ino: At global scope:
RTC_1_v2:79: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:80: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:81: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:82: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:83: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:84: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:85: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:86: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:87: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:88: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:89: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:90: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:91: error: expected constructor, destructor, or type conversion before '.' token
RTC_1_v2:92: error: expected declaration before '}' token
Can someone explain what's happening (simply please) and how I might phrase the string declaration?