hello
i have a problem
i am new in this filed, please help me
i don't what's the problem with this code, everytime i get this message "Switch_pin' was not declared in this scope" please help me !
this is my code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
if ( switch_pin == HIGH) {
digitalWrite(inletValvePin,HIGH); // turn pressure valve HIGH
digitalWrite(pumpPin,HIGH); // make sure pump is on
digitalWrite(exhaustValvePin,LOW); // turn exhaust valve LOW
digitalWrite(ledPin,HIGH); // LED ON
}
if ( switch_pin == LOW) {
digitalWrite(inletValvePin,LOW); // turn pressure valve HIGH
digitalWrite(pumpPin,LOW); // pump is off
digitalWrite(exhaustValvePin,HIGH); // turn exhaust valve HIGH
digitalWrite(ledPin,LOW); // LED off
}
sensorValue = analogRead(analogInPin);
// digital value of pressure sensor voltage
voltage_mv = (sensorValue * reference_voltage_mv) / ADCFULLSCALE;
// pressure sensor voltage in mV
voltage_v = voltage_mv / 1000;
output_pressure = ( ( (voltage_v - (0.10 * (reference_voltage_mv/1000) )) * (Pmax - Pmin) ) / (0.8 * (reference_voltage_mv/1000) ) ) + Pmin;
if (sensorValue <= desiredValue) {
analogWrite(pumpPin,255); // Pump. (0 is off) and (255 is on)
digitalWrite(inletValvePin,HIGH); // open the air valve
digitalWrite(exhaustValvePin,LOW); // close the exhaust valve
}
if (sensorValue > desiredValue) {
while (analogRead(A0) > (desiredValue - tolerance) ) {
analogWrite(pumpPin,190); // reduce speed of pump
digitalWrite(inletValvePin,HIGH); // open the air valve
digitalWrite(exhaustValvePin,LOW); // close the exhaust valve
}
}
}