I am using a DS3231 RTC to keep track of time and days for a project of mine and my incredibly limited experience with Arduino has got me stumped. I have defined the days as following:
//Define days of the week
char daysOfTheWeek[7][12] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
I believe the array values are Sun = 0 thru Sat = 6
Later in my code I try to use this for an if statement as follows in hopes that if these criteria are true then I can power up my output. However, I have created a false condition when I tested the system on Sunday (0) when the last part of the if statement is not true and I was still able to energize my output when I should not have been able to I would appreciate any help and direction someone could provide:
Upon further looking, when I serial print the dat it gives me "10" instead of 1 for Monday. Why is it giving me a value outside of the 7 identified days? What am I missing, does it have something to do with the [12] after the [7] in the initial message?
That is what I am thinking, I really need to be able to identify days of the week and not days of the month instead. I want this portion of my program to be true for Mon - Fri
7 am to 4 pm or thus the 7 - 16 shown in the initial code.
That is what the problem was! I also had it spelled "daysOfTheWeek" once I removed the "s" from days that and adjusting it in the if statement fixed the issue!
Thank you so much!!!!