Assitance sought to Solve Multiplexer Code Error

Hi There,
I am using Arduino Uno to connect to 64 Sensors via 04 Multiplexer Chips. The following code is part of the code I wrote to read the sensor Values. I get the error "......was not declared in this scope" for some of my variables. (ChipSelect0,ChipSelect1) The Compiler highlights the digitalWrite(ChipSelect0, LOW); line as the first error....what seems to cause this ?. Any assitance is much appreciated.

void setup()


// Numbering Control Pins - Digital
int PinSelect0 =0;
int PinSelect1 =1;
int PinSelect2 =2;
int PinSelect3 =3;

int ChipSelect0 =4;
int ChipSelect1 =5;

//Numbering Analog Read (Input) Pin
int InputPin = 0;

//Initialize control pins

pinMode(PinSelect0, OUTPUT);
pinMode(PinSelect1, OUTPUT);
pinMode(PinSelect2, OUTPUT);
pinMode(PinSelect3, OUTPUT);

pinMode(ChipSelect0, OUTPUT);
pinMode(ChipSelect1, OUTPUT);


void loop()

//Chip A - Send 1 and 1 to Select as active Low
digitalWrite(ChipSelect0, LOW);
digitalWrite(ChipSelect1, LOW);

//Read Value of Sensor1 by setting the values of PinSelect

digitalWrite(PinSelect0, LOW);
digitalWrite(PinSelect1, LOW);
digitalWrite(PinSelect2, LOW);
digitalWrite(PinSelect3, LOW);
int SensorValue = analogRead(InputPin); // read the arduino input pin the Chip is using
Serial.println(SensorValue); //use the result


“scope” is the clue - you’ve declared them INSIDE “setup”, so they’re not visible to “loop”.
Move them above “setup”

Thanks a million..AWOL
works fine now :slight_smile: