String and daysOfTheWeek

I want to make an if statement with an array which holds strings.

char daysOfTheWeek[7][12] = {“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”};

In the void loop I want to create an if statement. Technically, what it will do is check if it is Sunday, then it would turn on led1(pin 13).

I tried:

DateTime now = rtc.now();

if daysOfTheWeek[now.dayOfTheWeek()] == “Sunday”{
digitalWrite(ledArray[0], HIGH);
}

This was in the void loop.
The ledArray was an array i made earlier in the code with a bunch of leds.
I know the logic and what I want the code to do but I need help with the actual “code”.
I’m using RTClib and Wire libraries. The rtc is ds3231 and im using an arduino mega 2560.

Thank you

but I need help with the actual “code”.

We can’t see your code.

(Possibly use “strcmp”?)

TheMemberFormerlyKnownAsAWOL:
We can’t see your code.

(Possibly use “strcmp”?)

Sorry. I’m completely new. What is strcmp? The only reason I can’t share the code is because I need help actually coming up with it.

pearl2007: Sorry. I’m completely new. What is strcmp?

Part of a library of functions for dealing with strings, and many other things.

http://www.cplusplus.com/reference/cstring/strcmp/

https://www.nongnu.org/avr-libc/user-manual/modules.html

pearl2007:
char daysOfTheWeek[7][12] = {“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”};

DateTime now = rtc.now();

if daysOfTheWeek[now.dayOfTheWeek()] == “Sunday”{
digitalWrite(ledArray[0], HIGH);
}

now.dayOfTheWeek() will return 0 for Sunday, so why go to the trouble of comparing the text when you can compare the numbers?