How do I change codes made for OLED to lcd

I want to make a diy soldering station and am using a heater with a k type thermocouple. A descent one I found was from electronoobs, this one with some major modifications. He is using an i2c oled display, but I want to use a 16x2 lcd. Any help with changing the code? I'm a beginner and here's the code, Click here for code

Please don't make anyone download a zip.

Post the code, in code tags.

Members do not like to download code. We especially dislike downloading zip files from unknown places. Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

basically you must check each line of code containing a

display.

and you must change the OLED specific methods to LCD specific methods.

you must decide, what information you need on your 16x2, because you might have less space than on an OLED
example:
this:

      display.clearDisplay();
      display.setTextSize(3);
      display.setTextColor(WHITE);
      display.setCursor(20,4);
      display.print("SLEEP");   
      display.display(); 

will become something like

      display.clear();  // to be checked if clear is a good idea here
      display.setCursor(0,1);
      display.print("SLEEP");   

additionally the LCD object should be called display (instead of lcd like in most of the examples).
and you can remove all
display.display();

I suggest you start with some examples from the LCD library so you get used to it.

Ok thank you, and here's the code

#include "max6675.h" //http://www.ELECTRONOOBS.com/eng_arduino_max6675.php 
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>  //http://www.ELECTRONOOBS.com/eng_arduino_Adafruit_GFX.php
#include <Adafruit_SSD1306.h> //http://www.ELECTRONOOBS.com/eng_arduino_Adafruit_SSD1306.php
///////////////

//OLED setup
#define OLED_RESET 8
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 5
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
///////////////


//EN logo
static const unsigned char PROGMEM logo_EN[] =
{ 
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B00011110, B00011111, B00111111, B11001111, B11110011, B10000001, B11100000, B01111111, B10011111, B11000111, B00111100, B11001111, B11110000,
B00110011, B11111111, B11000000, B01111110, B00011111, B00111111, B11001111, B11110011, B10000001, B11110000, B01111111, B10011000, B01100111, B00111100, B11001100, B11110000,
B00110001, B11111111, B11000000, B11111110, B00011111, B00110000, B00001100, B00110011, B10000001, B10111000, B01110000, B00011000, B01100111, B00111100, B11001100, B00000000,
B00110011, B11111111, B11000000, B11111110, B00010001, B00110000, B00001100, B00110011, B10000001, B10011100, B01110000, B00011000, B11000111, B00110010, B11001100, B00000000,
B00111111, B11111111, B00000000, B11111110, B00010001, B00111111, B11001100, B00110011, B10000001, B10001110, B01111111, B10011111, B00000111, B00110010, B11001100, B00000000,
B00111111, B00000000, B00000000, B11111110, B00011001, B00111111, B11001100, B00110011, B10000001, B10001110, B01111111, B10011011, B00000111, B00110001, B11001100, B11110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00000000, B11001100, B00110011, B00000001, B10011100, B01110000, B00011011, B10000111, B00110001, B11001100, B11110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00000000, B11001100, B00110011, B10000001, B10110000, B01110000, B00011001, B11000111, B00110001, B11001100, B00110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00111111, B11001111, B11110011, B11111001, B11110000, B01111111, B10011000, B11000111, B00110000, B11001100, B11110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00111111, B11001111, B11110011, B11111001, B11100000, B01111111, B10011000, B01100111, B00110000, B11001111, B11110000,
B00111111, B11111111, B00000000, B11111011, B00011111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B11111111, B11000000, B11111011, B00011111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B10011111, B11000000, B11111011, B00011111, B00000000, B00000000, B00000000, B00011100, B11111111, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B10011111, B11000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11111111, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B11111111, B11000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11000011, B00110000, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11000011, B00110000, B11001111, B10110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11001110, B00110000, B11001111, B10110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11111000, B00110000, B11001111, B01110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B10001000, B11011111, B00000000, B00000000, B00000000, B00011100, B11111000, B00110000, B11001111, B01110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B10001000, B00011111, B00000000, B00000000, B00000000, B00011100, B11001100, B00110000, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B10011000, B01111111, B00000000, B00000000, B00000000, B00011100, B11000110, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00011100, B11000011, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00110011, B10000011, B11000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00100011, B10000011, B11000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00001111, B11000111, B11000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B11111000, B00011111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000
  };


//Sleep mode icon pressed
static const unsigned char PROGMEM press_logo[] =
{ 
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11100011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B11000010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B01100010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B00110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11000000, B11000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B01100001, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00001100, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00111110, B00000000, B00000000, B00000000, B00000000, B00011111, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, 
B00000111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, 
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000
  };
//Sleep mode icon unpressed
static const unsigned char PROGMEM no_press_logo[] =
{ 
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11100011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B11000010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B11000000, B11000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B01100010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B01100001, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B00110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00001100, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00111110, B00000000, B00000000, B00000000, B00000000, B00011111, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, 
B00000111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, 
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000
  };



//  Inputs and outputs
int butL = 4;     //left button
int butR = 7;     //right button
int ktcSO = 9;    //SPI pins for MAX6675 sensor
int ktcCS = 8;
int ktcCLK = 13;
int mosfet = 3;   //MOSFET pwm pin

MAX6675 ktc(ktcCLK, ktcCS, ktcSO);


//Variables
float temperature_read = 0;
int logo_slide =128;
unsigned long previousMillis = 0; 
float Delay=300;
int sleeplogo_count = 0;
bool sleepmode = true;
bool temp_change = false;
int sleep_out_count = 0;
float set_value = 250;
int temp_change_count = 0;
float min_temp = 200;
float max_temp = 480;
int both_pressed_count = 0;

//PID values
float P_pid = 0;
float I_pid = 0;
float D_pid = 0;
/////////////////////////////////
float kp = 18.8;
float ki = 0.02;
float kd = 1.4;
//////////////////////////////////
float kp_init = 18.8;
float ki_init = 0.02;
float kd_init = 1.2;
//////////////////////////////////
float kp_fine= 8.8;
float ki_fine = 0.42;
float kd_fine = 4.1;
//////////////////////////////////
float error = 0;
float error_percent = 0;
float previous_error = 0;
float PID_value = 0;

void setup() {
  Serial.begin(9600);
  pinMode(mosfet,OUTPUT);
  digitalWrite(mosfet,LOW);
  pinMode(butL,INPUT);
  pinMode(butR,INPUT);//Begin the display i2c omunication
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)  
  delay(200);
  display.clearDisplay();
  
  while(logo_slide >= 0)
  {
    display.clearDisplay();
    display.drawBitmap(logo_slide, 0,  logo_EN, 128, 32, 1);
    display.display();
    logo_slide = logo_slide-2;
    delayMicroseconds(700);
  }
  display.drawBitmap(0, 0,  logo_EN, 128, 32, 1);
  display.display();
  delay(500);
  display.clearDisplay();
  display.drawBitmap(0, 0,  no_press_logo, 128, 32, 1);
  display.display();   
}

void loop() {
  //Get out of sleepmode
  if((digitalRead(butL) || digitalRead(butR)) &&  sleepmode)
  {
    if(sleep_out_count > 1300)
    {
      sleepmode = false;
      sleep_out_count = 0;
      delay(100);
    }
    sleep_out_count = sleep_out_count + 1;      
  }//end of dig read of buttons and SLEEPMODE activated



  

  if(digitalRead(butR)  &&  !digitalRead(butL))
  {
    if(sleep_out_count > 6500)
    {
      temp_change = true;
      digitalWrite(mosfet,LOW);
      sleep_out_count = 0;
      set_value = set_value + 10;
       if (set_value > max_temp)
      {
        set_value = max_temp;  
      }
      
      display.clearDisplay();
      display.setTextSize(3);
      display.setTextColor(WHITE);
      display.setCursor(10,4);
      display.print(set_value); 
      display.display();   
    }
    sleep_out_count = sleep_out_count + 1;      
  }//increase temp

  if(digitalRead(butL)  && !digitalRead(butR))
  {
    if(sleep_out_count > 6500)
    {
      temp_change = true;
      digitalWrite(mosfet,LOW);
      sleep_out_count = 0;
      set_value = set_value - 10;

      if (set_value < min_temp)
      {
        set_value = min_temp;  
      }
      display.clearDisplay();
      display.setTextSize(3);
      display.setTextColor(WHITE);
      display.setCursor(10,4);
      display.print(set_value);   
      display.display(); 
    }
    sleep_out_count = sleep_out_count + 1;      
  }//decrease temp


  if(!digitalRead(butL) && !digitalRead(butR) && temp_change)
  {
    if(temp_change_count > 28000)
    {
      temp_change = false;
      temp_change_count = 0;
    }
    temp_change_count = temp_change_count + 1;
  }


  if(digitalRead(butL) && digitalRead(butR) && !sleepmode)
  {
    if(both_pressed_count > 30000)
    {
      sleepmode=true;
      digitalWrite(mosfet,LOW);
      display.clearDisplay();
      display.setTextSize(3);
      display.setTextColor(WHITE);
      display.setCursor(20,4);
      display.print("SLEEP");   
      display.display(); 
      delay(2000);
      both_pressed_count=0;
    }
    both_pressed_count = both_pressed_count +1;
  }



  

  if(sleepmode)
  { 
    if(sleeplogo_count > 3000 && sleeplogo_count < 3005)
    {
      display.clearDisplay();
      display.drawBitmap(0, 0,  press_logo, 128, 32, 1);
      display.display();        
    }
    if(sleeplogo_count > 6000 && sleeplogo_count < 6005)
    {
      display.clearDisplay();
      display.drawBitmap(0, 0,  no_press_logo, 128, 32, 1);
      display.display();
      sleeplogo_count = 0;       
    }
    sleeplogo_count = sleeplogo_count + 1;         
  }//end sleepmode

  
  
  //Start PID code
  unsigned long currentMillis = millis();
  if(  (currentMillis - previousMillis >= Delay) &&  (!sleepmode && !temp_change)){    
    previousMillis += Delay;
    if(!sleepmode)
    {
      temperature_read = (ktc.readCelsius());
      error = set_value - temperature_read + 3;
      error_percent = (error/set_value)*100.0;
      
      P_pid = kp * error;
      I_pid = I_pid + (ki * error);
      D_pid =  kd*((error - previous_error)/(Delay/1000));
      PID_value = P_pid + I_pid + D_pid;
            
      


      if(PID_value > 255)
      {
        PID_value = 255;
      }

       if(PID_value < 1)
      {
        PID_value = 1;
      }
/*
      if(error_percent > 20)
      {
        analogWrite(mosfet,250);
      }
      */

        analogWrite(mosfet,PID_value);


      display.clearDisplay();
      display.setTextSize(2);
      display.setTextColor(WHITE);
      display.setCursor(0,0);
      display.print("Set: ");
      display.setCursor(60,0);
      display.print(set_value,1);      
      display.setCursor(0,18);
      display.print("Temp: ");
      display.setCursor(60,18);
      display.print(temperature_read- 5,1);
      display.display();    //This functions will display the data
            
      previous_error = error;
    }



  }//end current milis



  
}//end void loop  


So basically, replace the oled libraries with the 16x2, replace the lines but keep the 'display. ' . Right?

And get rid of the 'logo' images since the LCD is not a graphical display.

Okay, thanks everyone!

I ran onto another problem. As suggested, I kept the prefix display.

display.clear() ;

Instead of the normal

lcd.clear() ;

And I get an error

'display' was not declared in this scope
Exit status 1
display. setCursor(0, 0) ;
^~~~~

We can't see your code

It's there, I posted it in the replies
Another update I replaced all

display.clear() ;
display.print() ;

Etc.. With

lcd.clear() ;
lcd.print() ;

And it compiled successfully. I will upload and test the code and test circuit tomorrow as I live in India and need to sleep

But display in that code refers to the Adafruit device, and you will have removed the bitmaps, so that code is not current.

Please post the actual error message(s) - all of them.

So, good news and bad news.
The code got uploaded and test circuit works fine.
But the pid doesn't work, pin 3 is always pulled high and no pwm signal is produced

chapter 6 describes exactly what you you should do now:

https://forum.arduino.cc/t/read-this-before-posting-a-programming-question/95349

Could it be the PID thinks the heater should be on full? That would set the PWM value to 255 and cause Pin 3 to be ON.

If your soldering station is up to temperature and the heater is STILL on full, you may have a problem with your temperature sensor. Are you displaying the temperature reading? Is it changing as expected?

As my heating element hasn't arrived yet, I am using a k type thermocouple which came with the MAX6675 and heating it up with my normal iron, and even when the temperature goes higher than the set one, it still stays at 5v.
I tested this first with an led and then with an oscilloscope. Same result

That page doesn't exist @noiasca

I would put in a bunch of Serial.print() to report all of the PID values:

      P_pid = kp * error;
      I_pid = I_pid + (ki * error);
      D_pid =  kd*((error - previous_error)/(Delay/1000));
      PID_value = P_pid + I_pid + D_pid;

Serial.print("T=");
Serial.print(temperature_read);
Serial.print(", e=");
Serial.print(error);
Serial.print(", e%="); 
Serial.print(error_percent);
Serial.print(", P=");
Serial.print(P_pid);
Serial.print(", I=");
Serial.print(I_pid);
Serial.print(", D=");
Serial.print(D_pid)
Serial.print(", PID=");
Serial.println(PID_value);

I just put

Serial.println(PID_value) ;

And it showed 255 which was definitely a problem
I tweaked the code a lot and seems to work fine now
Thanks everyone! The final breadboeard prototype works fine and I am currently moving it to a perfboard. After I finish it I will update the results!