Greetings;
After helping me with accessing struct elements with a for loop - Programming Questions - Arduino Forum,
(indexing structs), I'm stick again, trying to build and initialize an array of said struct.
This blip is before the loop
// analog sensor setup
struct PSensor {
int pId = 5; //identifies Analog Channel (min channel 5)------not in PRESSURE
int pSamples = 1; //number of samples to filter reading (default 1)
int pCalZero = 20; //sensor reading with no water column
int pCalHigh = 30; //sensor reading with max water column
int hRefZero = 40; //actual NO watercolumn height of sensor in CM (default is 0)
int hRefHigh = 200; //actual HIGH watercolumn height in CM (default 200)
int unitAdjust = 60; // adjust units to display VOLUME on screen (default 0-> bars, 1->CM, other m3))
int maxVol = 70; // maxVolume of tank (default 0)
};
//int testSensor[8] = {pId, pSamples, pCalZero, pCalHigh, hRefZero, hRefHigh, unitAdjust, maxVol};
PSensor aDisplay;
int *aPointer = (int*)&aDisplay;
int rainTank = 8; //rain water tank sensor shows volume of water
int houseLine = 9; //pressure inside the house
int poolFilter = 10; //pressure at the pool filter input
int balanceTank = 11; //pool balance tank volume
PSensor pChannel[4] = {
{rainTank,1,2,3,4,5,6,7},
{houseLine,10,2,3,4,5,6,7},
{poolFilter,11,2,3,4,5,6,7},
{balanceTank,12,2,3,4,5,6,7}
};
When I compile it, I get the following error:
could not convert '{8, 1, 2, 3, 4, 5, 6, 7}' from '<brace-enclosed initializer list>' to 'PSensor'
I tried moving the array definition into setup(), but it produces the same error.
I think I'm implementing verbatim what nickgammon says in #6 of "Array of Structs", but apparently not...