thanks for the reply.I did try to combine with code above.I got something like this
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//I2C pins declaration
#include <PID_v1.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
double Setpoint, Input, Output;
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint, 8.8, 1.4, 2.3, REVERSE);
int tempPin = A1; // analog input to read the temperature
int temp;
int set = 15; //set temperature variable
int lastset = 2;
int Counter1 = 0; // counter for the number of button presses
int Counter2 = 0; // counter for the number of button presses
int State1 = 0; // current state of the button
int State2 = 0; // current state of the button
int lastState1 = 0; // previous state of the button
int lastState2 = 0;
int val = 0;
const int set1 = 11; //temp up and temp down buttons
const int set2 = 12;
int pwm1 = 9; // pin ENA on L298N
int in_1 = 1; // in 1
int in_2 = 8; // in 2
int pwm2 = 10; // pin ENB on L298N
int in_3 = 6; // in 3
int in_4 = 7; // in 4
void setup() {
pinMode(set1, INPUT);
pinMode(set2, INPUT);
Input = analogRead(tempPin);
Setpoint = 15;
myPID.SetMode(AUTOMATIC);
myPID.SetSampleTime(200);
lcd.begin(16,2);
}
void loop() {
int temp = ((5.0/1024.0) * analogRead(A1)) * 100; //10mV per degree 0.01V/C. Scalling
lcd.setCursor(0,0);
lcd.print("Temperature:");
lcd.print(temp);
State1 = digitalRead(set1);
State2 = digitalRead(set2);
if (State1 != lastState1) {
if (State1 == HIGH && set!= 15) { //if up button is pressed, add 1 to des
set++;
}
}
if (State2 != lastState2) { //if down button is pressed, subtract 1 from des
if (State2 == HIGH && set!=5) {
set--;
}
}
myPID.Compute();
analogWrite(3, Output);
lcd.setCursor(0,1);
lcd.print("Set Point:");
lcd.print(set);
lcd.print("C ");
}