#define A_S2 3
#define A_S3 4
#define A_sensorOut A0
#define B_S2 5
#define B_S3 6
#define B_sensorOut A1
#define C_S2 7
#define C_S3 8
#define C_sensorOut A2
#define D_S2 9
#define D_S3 10
#define D_sensorOut A3
#define relayPin 2

//--------misc vars----------------------

int frequency = 0;
bool complete = LOW;
const int arSize = 5;
int sensorTest = 1;

//---------------A constraints--------------
//white
float AwMax = 4000;
float AwMin = 200;
float AwAvg[arSize];
//int aSpread = 50;
//red
//int ArMid = 1900;
float ArMax = 1.83;
float ArMin = 1.23;
float ArAvg[arSize];
//green
//int AgMid = 3370;
float AgMax = 4.43;
float AgMin = 1.95;
float AgAvg[arSize];
//blue
//int AbMid = 5440;
float AbMax = 11;
float AbMin = 5;
float AbAvg[arSize];

//---------------B constraints--------------
//white
float BwMax = 4100;
float BwMin = 200;
float BwAvg[arSize];
//int bSpread = 50;
//red
//int BrMid = 920;
float BrMax = 2.7;
float BrMin = 1.1;
float BrAvg[arSize];
//green
//int BgMid = 1033;
float BgMax = 4.2;
float BgMin = 2.5;
float BgAvg[arSize];
//blue
//int BbMid = 856;
float BbMax = 7.9;
float BbMin = 5.6;
float BbAvg[arSize];

//---------------C constraints--------------
//white
float CwMax = 4100;
float CwMin = 100;
float CwAvg[arSize];
//int cSpread = 50;
//red
//int CrMid = 1425;
float CrMax = 2.21;
float CrMin = 1.23;
float CrAvg[arSize];
//green
//int CgMid = 2130;
float CgMax = 4.33;
float CgMin = 2.74;
float CgAvg[arSize];
//blue
//int CbMid = 2570;
float CbMax = 9;
float CbMin = 5;
float CbAvg[arSize];

//---------------D constraints--------------
//white
float DwMax = 4100;
float DwMin = 100;
float DwAvg[arSize];
//int dSpread = 100;
//red
//int DrMid = 1560;
float DrMax = 2.35;
float DrMin = 1.13;
float DrAvg[arSize];
//green
//int DgMid = 2700;
float DgMax = 4.42;
float DgMin = 2.68;
float DgAvg[arSize];
//blue
//int DbMid = 5070;
float DbMax = 9;
float DbMin = 5;
float DbAvg[arSize];

//------------------Basics--------------------

void setup() {
  pinSetUp();
  Serial.begin(9600);
  digitalWrite(relayPin, HIGH);
  zeroArray(ArAvg,arSize);
  zeroArray(AgAvg,arSize);
  zeroArray(AbAvg,arSize);
  zeroArray(BrAvg,arSize);
  zeroArray(BgAvg,arSize);
  zeroArray(BbAvg,arSize);
  zeroArray(CrAvg,arSize);
  zeroArray(CgAvg,arSize);
  zeroArray(CbAvg,arSize);
  zeroArray(DrAvg,arSize);
  zeroArray(DgAvg,arSize);
  zeroArray(DbAvg,arSize);
}

void loop() {
  while(complete == LOW){
    testColorSensors();
  }
  Serial.print("It better be done");
  delay(120000);
}
