I had created array of structures. It contains sunrise, sunshine and noon times for each day of the year- has predefined data.
Looks like array is too long, as, if it contains more than 212 elements, code stops working (i need about 368 elements) Could you point me to more advanced programming guidelines about Arduous memory types, layout,memory management, if such exists..
Existing reference material is very basic, for example typedef is not even mentioned , however is widely used by Arduino software.
see test code (syntax is right)
To make it more compact, I had deleted most of array elements
typedef struct {
unsigned char mNum;
unsigned char mDay;
unsigned char rHour;
unsigned char rMin;
unsigned char sHour;
unsigned char sMin;
unsigned char nHour;
unsigned char nMin;
} SUNTIME;
SUNTIME sSunTime[] = {
{ 1, 1, 9, 1, 15, 53, 12, 27},
{ 1, 2, 9, 1, 15, 55, 12, 28},
{ 1, 3, 9, 0, 15, 56, 12, 28},
// a lot of elements are deleted to shorten example
{ 7, 31, 5, 20, 21, 39, 13, 30}, // this is an element 212
};
/* If this and previous line has to be moved after next element of array - 213 element, code stops working.
{ 8, 1, 5, 22, 21, 37, 13, 30},
{ 8, 2, 5, 24, 21, 35, 13, 30},
// here a lot of elements are deleted to shorten example
{12, 31, 9, 1, 15, 52, 12, 26},
{ 0, 0, 0, 0, 0, 0, 0, 0} // element 368, i guess
};
*/
void setup() {
Serial.begin(9600);
delay(1000);
Serial.println("Start ");
delay(1000);
PrintTime();
}
void loop() {
delay(1000);
}
void PrintTime(void){
int i;
for (i = 0; i < sizeof(sSunTime)/sizeof(SUNTIME); i++){
Serial.print(" i="); Serial.print(i, DEC);
Serial.print(" M= "); Serial.print(sSunTime[i].mNum, DEC);
Serial.print(" D= "); Serial.print(sSunTime[i].mDay, DEC);
Serial.print(" rH= "); Serial.print(sSunTime[i].rHour,DEC);
Serial.print(" rM= "); Serial.print(sSunTime[i].rMin ,DEC);
Serial.print(" sH= "); Serial.print(sSunTime[i].sHour,DEC);
Serial.print(" SM= "); Serial.print(sSunTime[i].sMin,DEC);
Serial.print(" nH= "); Serial.print(sSunTime[i].nHour,DEC);
Serial.print(" nM= "); Serial.print(sSunTime[i].nMin,DEC);
Serial.println( ". ");
}
}