Automatic hydroponic system

hi I am using the Arduino 101 and I have no idea how to read error message I have been trying to figure it out and I got no clue what's happening if anyone could help it would be amazing.

the Error message: C:\Users\ffera\Documents\Arduino\allmost there\allmost there.ino: In function 'void setup()':
C:\Users\ffera\Documents\Arduino\allmost there\allmost there.ino:50:3: error: 'gravityTds' was not declared in this scope
gravityTds.setPin(TdsSensorPin);
^
C:\Users\ffera\Documents\Arduino\allmost there\allmost there.ino: In function 'void loop()':
C:\Users\ffera\Documents\Arduino\allmost there\allmost there.ino:85:3: error: 'gravityTds' was not declared in this scope
gravityTds.setTemperature(temperature); // set the temperature and execute temperature compensation
^
C:\Users\ffera\Documents\Arduino\allmost there\allmost there.ino:103:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
while(flag = 0){
^

exit status 1

Compilation error: 'gravityTds' was not declared in this scope

#include <GravityTDS.h>

#include <EEPROM.h>


#define TdsSensorPin A1
#include <SPI.h> // Talking thing

#include <WiFi101.h> 
                          
#include <Wire.h>                                                                               
#include <SimpleDHT.h>                                                                                        
#include <LiquidCrystal_I2C.h>                                                                             

int lControl =  6; 

char ssid[] = "YourNetwork";

char pass[] = "YourPassword";

int keyIndex = 0;

int status = WL_IDLE_STATUS;


float temperature = 25,tdsValue = 0;

 int pinDHT11 = 2;

  int flag = 0;




WiFiServer server(80); 



           // for DHT11,
           //      VCC: 5V or 3V
           //      GND: GND
           //      DATA: 2

SimpleDHT11 dht11(pinDHT11);
LiquidCrystal_I2C lcd(0x27, 16, 2);


void setup() {
  Serial.begin(115200);
  gravityTds.setPin(TdsSensorPin);
  gravityTds.setAref(5.0);  //reference voltage on ADC, default 5.0V on Arduino UNO
  gravityTds.setAdcRange(1024);  //1024 for 10bit ADC;4096 for 12bit ADC
  gravityTds.begin();  //initialization
  // translation for ariana: Uncomment serial for debugging and to see details of WiFi connection
  
  // check for the presence of the shield:
  //translation for ariana:make sure seild is working
  if (WiFi.status() == WL_NO_SHIELD) {
    //  Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  //translation for ariana: attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    //   Serial.print("Attempting to connect to SSID: ");
    //   Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
    delay(10000);
  }
  server.begin();
  // you're connected now, so print out the status:
  // printWifiStatus();
}

// translation for ariana:all the other stuff you dont need to know yet

void loop() {
  // start working...
  Serial.println("=================================");
  Serial.println("Sample DHT11...");
  //temperature = readTemperature();  //add your temperature sensor and read it
  gravityTds.setTemperature(temperature);  // set the temperature and execute temperature compensation
  gravityTds.update();  //sample and calculate
  tdsValue = gravityTds.getTdsValue();  // then get the value
  Serial.print(tdsValue,0);
  Serial.println("ppm");
  delay(1000);
  // read without samples.
  byte temperature = 0;
  byte humidity = 0;

  int err = SimpleDHTErrSuccess;
  if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT11 failed, err="); Serial.println(err); delay(1000);
    return;


  }

  while(flag = 0){
    int newtemp = ( temperature * 1.8) + 32;

    lcd.begin();

    // Turn on the blacklight and print a message.
    lcd.backlight();
    lcd.print("tempature  "); lcd.print((int)newtemp);
    lcd.setCursor(0, 1);
    lcd.print("humidity  ");
    lcd.print((int)humidity);
    delay(1000);

  }
  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {                             // if you get a client,
    // Serial.println("new client");           // print a message out the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        // Serial.write(c);                    // print it out the serial monitor
        if (c == '\n') {                    // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
            client.print("Value at A0 is ");
            client.print(analogRead(A0));
            client.print("<br>");
            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          }
          else {      // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        }
        else if (c != '\r') {    // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }

        // Check to see if the client request was "GET /H" or "GET /L":
        if (currentLine.endsWith("GET /H")) {
          digitalWrite(lControl, HIGH);               // GET /H turns the LED on
        }
        if (currentLine.endsWith("GET /L")) {
          digitalWrite(lControl, LOW);                // GET /L turns the LED off
        }
      }
    }
    // close the connection:
    client.stop();
    // Serial.println("client disconnected");
  }
}


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

Looking at the example code provided with the library, you're missing a line in your code such as this:

GravityTDS gravityTds;

Did you mean to assign zero to flag?
That will always be false.

Hi,'
Not sure what you are trying to do here?

if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) 

Tom.. :smiley: :coffee: :+1: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.