if statement help needed

so im trying to make if statement on a project where an stepper and an 1602 i2c lcd and an temp sensor and an potentometer is used the potentometer controlls the speed of the stepper but to keep updating the screen to showe the temp and the potentometer data slows down the stepper ALOT takes to long to ud update in every loop so what i want is to only update the lcd if temp change or the potentometer data changes

PS. im an beginner in programming stil got a shit load to learn.

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <math.h>
#include <AccelStepper.h>
#define ThermistorPIN 0  

int tempset;
int temppot = 1;
int potpinfeed = 3;
int feedrate;


AccelStepper stepper(1, 9, 6);
float vcc = 4.81;                       // only used for display purposes, if used                                       // set to the measured Vcc.
float pad = 9850;                       // balance/pad resistor value, set this to                                     // the measured resistance of your pad resistor
float thermr = 10000;                   // thermistor nominal resistanc
float Thermistor(int RawADC) {
  long Resistance;  
  float Temp;  // Dual-Purpose variable to save space.
Resistance=pad*((1024.0 / RawADC) - 1);
  Temp = log(Resistance); // Saving the Log(resistance) so not to calculate  it 4 times later
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 227.75;  // Convert Kelvin to Celsius
 return Temp;                                      // Return the Temperature
}
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display


void setup()
{  
  lcd.init();                      // initialize the lcd 
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("    starting    ");
  lcd.setCursor(0,1);
  lcd.print("filament extrude");
  delay(1000);
  Serial.begin(9600);
   stepper.setMaxSpeed(1000);
   stepper.setSpeed(400);	
     lcd.clear();
     lcd.print("Temp :");
     //lcd.print(temp,0);
    lcd.print("/");
   lcd.print(tempset); 
}

void loop()
{  
   stepper.runSpeed();
   float temp;
  temp=Thermistor(analogRead(ThermistorPIN)); 
   tempset = analogRead(temppot);            // reads the value of the potentiometer (value between 0 and 1023) 
  tempset = map(tempset, 0, 1023, 0, 290);
   //delay(3000);
   
   
    if ((tempset ) && (tempset ))  
      {
         lcd.clear();
     lcd.print("Temp :");
     lcd.print(temp,0);
    lcd.print("/");
   lcd.print(tempset); 
   
        {
         
        }
      
        }
        else
        {
         stepper.runSpeed();
        }
      
   
      
}

== not && Look them up in the reference section.

Mark

What is this bit supposed to achieve?
What is the point of using temset twice in the IF?
What is the && supposed to do?
Are the brackets correct?
Why is stepper.runSpeed() in it:

  if ((tempset ) && (tempset ))  
      {
         lcd.clear();
     lcd.print("Temp :");
     lcd.print(temp,0);
    lcd.print("/");
   lcd.print(tempset); 
   
        {
         
        }
      
        }
        else
        {
         stepper.runSpeed();
        }

Perhaps you should take the LCD statements and put them in a function separate from loop() and called less frequently

...R

what i whant this to do is when the value from the potentometer(tempset) is changed i whant the lcd to update but if the value from the potentometer isent changed

int tempupdate;
   //tempset = potentometer
   
    if ((tempset) < (tempupdate))   
      {
         lcd.clear();
     lcd.print("Temp :");
     lcd.print(temp,0);
    lcd.print("/");
   lcd.print(tempset); 
   tempupdate = tempset ;
       if((tempset) > (tempupdate))
        {
        lcd.clear();
     lcd.print("Temp :");
     lcd.print(temp,0);
    lcd.print("/");
   lcd.print(tempset); 
   tempupdate = tempset ;
      }
        else
        {
         stepper.runSpeed();
        }
      Serial.print(tempupdate);
      Serial.println(tempset);
   
      
}
}

You should fix the indentation so the code can be read, currently its just a source of confusion.

       if((tempset) > (tempupdate))

why the extra parantheses? Change to

       if (tempset > tempupdate)

again to make the code more readable.

got it working almost did as you said changed it to this

if (tempset < tempupdate || tempset > tempupdate)
if (tempset < tempupdate || tempset > tempupdate)

You could write the same thing with fewer keystrokes (and probably easier to understand) as ...

if (tempset != tempupdate)

... where "!=" is the "not equal to" operator.