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!!