sterretje:
Further, if you changeoutput_t outputs[5]; //can have max 5 outputs for each button; this holds an array of output_t objectsin your button_t struct to
output_t *outputs; // outputs
byte numOutputs; // number of outputs
You do not have the limitation of 5 outputs; due to the use of a byte variable it's now limited to 256 (and if you use an unsigned int, it will be 65536.
I limited to 5 so that I could iterate a known number if times in a for loop later as I can't find the length of an array in code to allow doing it dynamically.
Is this still an array of output_t structs ?
output_t *outputs; // outputs
byte numOutputs; // number of outputs
I changed to this (array of pointers):
byte num_outputs;
output_t *outputs; //this holds an array of pointers output_t objects
And assign them members like this:
button0.num_outputs = 3;
button0.outputs[0] = output0;
button0.outputs[1] = output1;
button0.outputs[2] = output2;
Where does button0.num_outputs get used ? How is the length of the array of pointers defined ?