Research project about automatic hydroponics system

my name is Patrick and I am 15 I am a research student at a high school I am having trouble figuring out what is wrong with my code. But I must admit like most coders do I just copped and pasted most of it so if somebody could help me out that would be great.

and the error messages when i compile : Sketch uses 33228 bytes (103%) of program storage space. Maximum is 32256 bytes.
Global variables use 1721 bytes (84%) of dynamic memory, leaving 327 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
text section exceeds available space in board

Compilation error: text section exceeds available space in board

here's the code:

#include <EEPROM.h>
#include "GravityTDS.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");
}

that should already be a big indication of what the issue is...

So, is that after you visited https://support.arduino.cc/hc/en-us/articles/360013825179 and read through that?

Thank you this is my first time working with Arduino I have no idea what I am doing

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