I have problem tying 2 sketches together -- i need help please

Hello all!

I am quite new to this esp8266 wifi module thing. I have been given the task of working on a project that
has to do with IoT. With the help of tutorials and libraries, i was able to put the esp8266 wifi module up and running with the arduino board.

Here’s where i get stucked all the time - tying up the lcd library with the esp8266 wifi skecth.

I’d greatly appreciate your help.

PS: I want to be able to view which button is clicked (or ON) and which one is in the OFF state.

Here’s the code:

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#define DEBUG true

 // initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,5,4,3,2);


SoftwareSerial esp8266(2,3); // make RX Arduino line is pin 2, make TX Arduino is pin 3
                             // This means that you need to connect the TX line from the esp to the Arduino's pin 2
                             // and the RX line from the esp to the Arduino's pin 3

void setup() {
    // initialize the serial communications:
    Serial.begin(9600); 
    esp8266.begin(9600); // your esp's baud rate

      pinMode(10,OUTPUT);
      digitalWrite(10,LOW);
      
      pinMode(11,OUTPUT);
      digitalWrite(11,LOW);
      
      pinMode(12,OUTPUT);
      digitalWrite(12,LOW);
      
      pinMode(13,OUTPUT);
      digitalWrite(13,LOW);
       
      sendData("AT+RST\r\n",2000,DEBUG); // reset module
      sendData("AT+CWMODE=2\r\n",1000,DEBUG); // configure as access point
      sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address
      sendData("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections
      sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80

      // set up the LCD's number of columns and rows:
      lcd.begin(16,2);
      lcd.setCursor(2,0)
      lcd.print() 
}

void loop() 
{
 if(esp8266.available()) // check if the esp is sending a message 
      {
     
        
        if(esp8266.find("+IPD,"))
        {
         delay(1000); // wait for the serial buffer to fill up (read all the serial data)
         // get the connection id so that we can then disconnect
         int connectionId = esp8266.read()-48; // subtract 48 because the read() function returns 
                                               // the ASCII decimal value and 0 (the first decimal number) starts at 48
              
         esp8266.find("pin="); // advance cursor to "pin="
         
         int pinNumber = (esp8266.read()-48)*10; // get first number i.e. if the pin 13 then the 1st number is 1, then multiply to get 10
         pinNumber += (esp8266.read()-48); // get second number, i.e. if the pin number is 13 then the 2nd number is 3, then add to the first number
         
         digitalWrite(pinNumber, !digitalRead(pinNumber)); // toggle pin    
         
         // make close command
         String closeCommand = "AT+CIPCLOSE="; 
         closeCommand+=connectionId; // append connection id
         closeCommand+="\r\n";
         
         sendData(closeCommand,1000,DEBUG); // close connection
        }
      }

      
    }
     
    /*
    * Name: sendData
    * Description: Function used to send data to ESP8266.
    * Params: command - the data/command to send; timeout - the time to wait for a response; debug - print to Serial window?(true = yes, false = no)
    * Returns: The response from the esp8266 (if there is a reponse)
    */
    String sendData(String command, const int timeout, boolean debug)
    {
        String response = "";
        
        esp8266.print(command); // send the read character to the esp8266
        
        long int time = millis();
        
        while( (time+timeout) > millis())
        {
          while(esp8266.available())
          {
            
            // The esp has data so display its output to the serial window 
            char c = esp8266.read(); // read the next character.
            response+=c;
          }  
        }
        
        if(debug)
        {
          Serial.print(response);
        }
        
        return response;
    }

Hey, and welcome to the forum. Please post your code in code </> tags so it’s easier to view. Take a look at this, to start.

Thank you for pointing that out to me. I am making that correction already

If I could suggest something, I'd try to get this done without the wifi module first. Once you get this sketch running, then you can integrate iOT. :)

Thanks Chummer...

Its the sketch that's really giving me a tough time...how do i tie up the LCD Sketch to the esp8266 wifi sketch?