> #include <GravityTDS.h>
> #include <LCD_I2C.h>
> #include <OneWire.h>
> #include <DallasTemperature.h>
> #include <Wire.h>
> LCD_I2C lcd(0x27, 20, 4);
>
> #define ONE_WIRE_BUS 9
> #define TdsSensorPin0 A1
> #define TdsSensorPin1 A2
> const float OffSet = 0.473 ;
> const float OffSet1 = 0.479 ;
> float V;
> float V1;
> int P;
> int P1;
> int sensorup = 2;
> int senstordw = 3;
> const int pumppres = 4;
> const int evwaterin = 5;
> const int evflush = 6;
> const int evroout = 7;
> const int logdisp = 8;
> int btup = 0;
> int btdw = 0;
>
> OneWire oneWire(ONE_WIRE_BUS);
> GravityTDS gravityTds0;
> GravityTDS gravityTds1;
>
> DallasTemperature sensors(&oneWire);
>
>
> float tdsValue0 = 0;
> float tdsValue1 = 0;
>
> void setup()
> {
> Serial.begin(115200);
> lcd.begin();
> lcd.backlight();
> sensors.begin();
> gravityTds0.setPin(TdsSensorPin0);
> gravityTds1.setPin(TdsSensorPin1);
> gravityTds0.setAref(5.0); //reference voltage on ADC, default 5.0V on Arduino UNO
> gravityTds0.setAdcRange(1024); //1024 for 10bit ADC;4096 for 12bit ADC
> gravityTds0.begin(); //initialization
> gravityTds1.setAref(5.0); //reference voltage on ADC, default 5.0V on Arduino UNO
> gravityTds1.setAdcRange(1024); //1024 for 10bit ADC;4096 for 12bit ADC
> gravityTds1.begin(); //initialization
>
> pinMode(sensorup, INPUT_PULLUP);
> pinMode(sensordw, INPUT_PULLUP);
> pinMode(pumppres, OUTPUT);
> pinMode(evwaterin, OUTPUT);
> pinMode(evflush, OUTPUT);
> pinMode(evroout, OUTPUT);
>
> digitalWrite(pumppres, LOW);
> digitalWrite(evwaterin, LOW);
> digitalWrite(evflush, LOW);
> digitalWrite(evroout, LOW);
> }
> void flush1()
> {
> digitalWrite(evflush, HIGH);
> digitalWrite(evroout, HIGH);
> delay(3000);
> digitalWrite(pumppres, HIGH);
> delay(5500);
> digitalWrite(evwaterin, HIGH);
> delay(2000);
> digitalWrite(evflush, LOW);
> digitalWrite(evroout, LOW);
> }
> void cycle1()
> {
> digitalWrite(pumppres, HIGH);
> digitalWrite(evwaterin, HIGH);
> }
> void tankfull()
> {
> digitalWrite(pumppres, LOW);
> digitalWrite(evwaterin, LOW);
> digitalWrite(evflush, LOW);
> digitalWrite(evroout, LOW);
> lcd.clear();
> lcd.setCursor(0, 3);
> lcd.print("TANK FULL");
> }
> void nopreshure()
> {
> digitalWrite(pumppres, LOW);
> digitalWrite(evwaterin, LOW);
> digitalWrite(evflush, LOW);
> digitalWrite(evroout, LOW);
> lcd.clear();
> lcd.setCursor(0, 0);
> lcd.print("NO WATER PRESHURE");
> }
> void hpnopreshure()
> {
> digitalWrite(pumppres, LOW);
> digitalWrite(evflush, LOW);
> digitalWrite(evroout, LOW);
> lcd.clear();
> lcd.setCursor(0, 1);
> lcd.print("HP PUMP NO PRESHURE");
> }
>
> void loop()
> {
>
> sensors.requestTemperatures();
>
> gravityTds0.setTemperature(sensors.getTempCByIndex(0)); // set the temperature and execute temperature compensation
> gravityTds0.update(); //sample and calculate
> gravityTds1.setTemperature(sensors.getTempCByIndex(0)); // set the temperature and execute temperature compensation
> gravityTds1.update(); //sample and calculate
>
> tdsValue0 = gravityTds0.getTdsValue(); // then get the value
> tdsValue1 = gravityTds1.getTdsValue(); // then get the value
>
> //Connect sensor to Analog A0 A3
> V = analogRead(0) * 5.00 / 1024; //Sensor output voltage
> P = (V - OffSet) * 250 * 0.1; //Calculate water pressure
> V1 = analogRead(3) * 5.00 / 1024; //Sensor output voltage
> P1 = (V1 - OffSet1) * 250 * 0.1; //Calculate water pressure
>
> Serial.print(tdsValue0, 0);
> Serial.print(tdsValue1, 0);
> Serial.println("ppm");
>
> lcd.clear();
> lcd.setCursor(0, 0);
> lcd.print("TDS0 IN: ");
> lcd.print(tdsValue0, 0);
> lcd.print(" PPM");
>
> lcd.setCursor(0, 1);
> lcd.print("TDS1 OUT: ");
> lcd.print(tdsValue1, 0);
> lcd.print(" PPM");
>
> lcd.setCursor(0, 2);
> lcd.print("Temp: ");
> lcd.print(sensors.getTempCByIndex(0));
> lcd.print(" C");
>
> lcd.setCursor(0, 3);
> lcd.print("IN:");
> lcd.setCursor(3, 3);
> lcd.print( P / 100 % 10);
> lcd.print( P / 10 % 10);
> lcd.print('.');
> lcd.print( P / 1 % 10);
> lcd.setCursor(10, 3);
> lcd.print("PO:");
> lcd.setCursor(13, 3);
> lcd.print( P1 / 100 % 10);
> lcd.print( P1 / 10 % 10);
> lcd.print('.');
> lcd.print( P1 / 1 % 10);
>
> delay(50);
>
> btup = digitalRead(sensorup);
> btdw = digitalRead(sensordw);
>
> if (V <= 1.0)
> {
> nopreshure();
> {
> if (V1 <= 2.5);
> {
> hpnopreshure();
> while ((digitalRead(btup == LOW)) && (digitalRead(btdw == LOW)))
> {
> flush1();
> delay(10500);
> cycle1();
> {
> while ((digitalRead(btdw == HIGH)) && (digitalRead(btup == HIGH)))
> {
> tankfull();
> }
> }
> }
> }
> }
> }
> }
OK so i made this code for a smart reverse osmosis system witch take in consideration the pressures for input water and pressure pump and i have a little trouble with the compilation gives me some errors
exit status 1
'sensordw' was not declared in this scope
any one can give a hand pls?