if statements

Hi all, im really late with a project im working on and i can’t seem to get the code right.
in the code below im using a scale to measure weight and i want to display certain things on my lcd at certain points.

once the scale reaches over 10 i want the lcd to display “hold” for 5 seconds and then to display “complete” once the 5 second is up.

i also want it to display fail if the value falls below 10 in the 5 second time period

ive had alot of problems and tried many different approaches and think im getting a little mixed up now.

can someone please fix this for me.

 unsigned long currentMillis = millis() ; {       // GRAB CURRENT TIME
if     (units > 10) {
                if ((currentMillis - previousMillis) >= interval) {

        ledState = !ledState;
        digitalWrite(3, ledState);       
       
        lcd.setCursor (0, 0);                     //SET CURSOR TO ROW 1
        lcd.print("------HOLD------");            //PRINT HOLD
previousMillis = currentMillis;

if     (units < 10) {
                if ((currentMillis - previousMillis) < interval) { 
        ledState = !ledState;
        digitalWrite(3, ledState);       
       
        lcd.setCursor (0, 0);                     //SET CURSOR TO ROW 1
        lcd.print("------fail------");            //PRINT fail
                                       
      }
       } else  if ((currentMillis - previousMillis) < interval) { //IF UNITS MORE THAN 3 AND CURRENT TIME-PREVIOUS TIME IS LESS THAN THE INTERVAL PEROID DO NEXT LINE


        digitalWrite(3, LOW);       
        digitalWrite(2, HIGH);       
        lcd.setCursor (0, 0);                     //SET CURSOR TO ROW 1
        lcd.print("--complete--");            //PRINT complete

previousMillis = currentMillis;

      }


    }

TIA

Always show us your ‘current’ complete sketch. Use CTRL T to format the sketch.

You only ever capture millis() at the start and then go on to compare against an unchanging value. currentMillis needs to be updated from time to time to reflect the ticking of the clock.

I think you want this:

  unsigned long currentMillis = millis() ;         // GRAB CURRENT TIME


  if (previousMillis == 0)
  {
    // Timer is not yet running
    if (units > 10)
    {
      previousMillis = currentMillis;  // Start the timer


      ledState = HIGH;
      digitalWrite(3, ledState);  // Turn on the LED


      // Display HOLD
      lcd.setCursor (0, 0);
      lcd.print("------HOLD------");
    }
  }
  else
  {
    // Timer is running
    if (units < 10)
    {
      ledState = LOW;
      digitalWrite(3, ledState);  // Turn off the LED


      // Display FAIL
      lcd.setCursor (0, 0);                     //SET CURSOR TO ROW 1
      lcd.print("------fail------");            //PRINT fail
      previousMillis = 0;  // Stop the timer
    }
    else
    {
      //  Timer is still running
      if ((currentMillis - previousMillis) >= interval)
      {
        // Timer completed successfully
        digitalWrite(3, LOW);
        digitalWrite(2, HIGH);
        lcd.setCursor (0, 0);                 //SET CURSOR TO ROW 1
        lcd.print("--complete--");            //PRINT complete


        previousMillis = 0;  // Turn off the timer
      }
    }
  }