I have set up two structures as per the code below.
struct SEND_DATA_STRUCTURE {
float humidity;
float temperature;
unsigned int ldr;
unsigned int lux;
unsigned int onTime[8];
};
struct RECEIVE_DATA_STRUCTURE {
int boilerStatus;
};
SEND_DATA_STRUCTURE txData; // give names to the groups of data
RECEIVE_DATA_STRUCTURE rxData;
in the code below initializing the array elements works OK. However, the commented out line doesn’t work and causes a compiler error.
txData.onTime[7] = 82; This work OK.
// txData.onTime[8] = 12,22,32,42,52,62,72,82; This causes an error.
Can someone please tell me how, if it is possible to initialize all the array elements in one go.
Also is it possible to use a FOR loop to step through the array elements to print them out for example.
Any help would be greatly appreciated as I have searched the internet and cannot find the answers.
Thanks
Bob