CO2 gas sensor and solenoid valve

Hi everyone,
I am working on a project in my lab and need to create a system that will open a gas valve when the CO2 level is below a certain level, and to shut the valve when the CO2 rises above this level. So far I have gotten the arduino and vernier sensor interface shield to read the CO2 levels, but when adding a motor shield into the mix, the CO2 can no longer be read. The gas valve I am using is a US solid model #JFSV00065. The motor shield will not turn the valve on or off with the code I am using. Not sure if its the code or the valve. Heres what I have so far:

int sensor = A0;
int sensorValue = 0;

void setup() {

//Setup Channel A
pinMode(13, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
Serial.begin(9600);
}

void loop(){
sensorValue = analogRead(sensor);
Serial.println(sensorValue, DEC);
if (sensorValue > 500) {
digitalWrite(13, LOW); //Establishes backward direction of Channel A
digitalWrite(9, HIGH); //engage the Brake for Channel A
}

else {

digitalWrite(9, LOW); //disengage the Brake for Channel A
digitalWrite(13, HIGH); //Establishes forward direction of Channel A
analogWrite(3, 255); //Spins the motor on Channel A at fullft speed

}

}

Someone please help!!

Please format your code properly (use ctrl-T in the IDE) to have consistent indentation, that helps a lot. And add code tags when posting code to make it a lot more readable overall.

You also have to check your comments as they talk about motors/directions and what you have are a sensor and a solenoid (on/off valve).

One thing that stands out is this:

  analogWrite(3, 255);   //Spins the motor on Channel A at fullft speed

Other than that PWM and solenoid valves don't normally go together (in this case it doesn't matter: under the hood this is translated to digitalWrite(3, HIGH)), this is the one and only place where you write anything to pin 3.