Folks,
I'm working on a clock that is programmed with mostly birthdays, but also some anniversaries, and a few RIPs for some special people that have passed. I have about 100 people so far but I'm new to programming so I used 100 if statements. I have yet to learn about arrays so I thought this would be a good opportunity for me to learn - hopefully I didn't pick a task too hard for someone of my skill level. My initial thought was to use a the following format.
Name, Month of Birth, Day of Birth, 1-3 (1 = Bday, 2 = Anniversary, 3 = RIP)
Below is my attempt at the code but it did not compile. Your thoughts about my approach or the error I'm getting below would be appreciated.
char birthdays[15,4] = { { "Amanda",1,2,1}, // Name, Month, Day, 1=Bday 2=Anniversary 3=RIP
{ "Amy",1,4,1 },
{ "Bill",1,5,1 },
{ "Bob",1,13,1 },
{ "Carl",1,21,1 },
{ "Dan",2,2,1 },
{ "Diane",2,7,1 },
{ "Edna",3,15,1 },
{ "Frank & Lisa",5,20,2 },
{ "George",6,18,3 },
{ "Hank",7,2,1 },
{ "Joan",8,13,1 },
{ "Kim & Dan",9,13,2 },
{ "Larry",10,13,1 },
{ "Mary",11,17,1 } };
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print(birthdays[0][0]); // I want to print "Amanda"
}
void loop() {
// put your main code here, to run repeatedly:
}
Error.
Array:2:18: error: expected ']' before ',' token
char birthdays[15,4] = { { "Amanda",1,2,1}, // Name, Month, Day, 1=Bday 2=Anniversary 3=RIP
^
Array:2:19: error: expected unqualified-id before numeric constant
char birthdays[15,4] = { { "Amanda",1,2,1}, // Name, Month, Day, 1=Bday 2=Anniversary 3=RIP
^
/Users/tonyperry/Documents/Arduino/Array/Array.ino: In function 'void setup()':
Array:22:14: error: 'birthdays' was not declared in this scope
Serial.print(birthdays[0][0]);
^~~~~~~~~
exit status 1
expected ']' before ',' token
Also, I'm new to Arduinos and programing. What are some good basic books for someone like me, without very much experience.
Best,
Tony