help getting loop to loop

ok let me try to explane that better. sencerest apoligies that the wording was so bad :frowning:

what i am trying to figure out is weather when the if statment consering select is activated, do i need to totay back out of the loop to run the next loop or can i run a second loop within the 1st loop?

#include <LiquidCrystal.h>   // include LCD library
#include <Stepper.h>

#define STEPS 200

Stepper stepper(STEPS, 2, 12, 10, 11);


int val = 0;
int analogPin = 0;
float counter = 0;
float seconds = 0;


// Defenitions
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input
#define LCD_BACKLIGHT_PIN         3  // D3 controls LCD backlight

#define RIGHT_10BIT_ADC           3  // right
#define UP_10BIT_ADC            142  // up
#define DOWN_10BIT_ADC          328  // down
#define LEFT_10BIT_ADC          504  // left
#define SELECT_10BIT_ADC        741  // select

#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH ) 

;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 ); 

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to



void setup()
{
  pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input
  digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0

  digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)
  pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output

  //set up the LCD number of columns and rows: 
  lcd.begin( 16, 2 );

  lcd.setCursor( 0, 0 );

  lcd.print("Select Time");

  lcd.setCursor (0, 1);

  lcd.print("Sec:");

  lcd.print(counter);
  
  stepper.setSpeed(30);

}

void loop()
{
  val = analogRead(0);

  enum direction {
    RIGHT, UP, DOWN, LEFT, SELECT, NONE  } 
  dir; 
  if  ( val <100 ) dir = RIGHT;
  else if  (val == 142) dir = UP;
  else if  ( val == 328 )  dir = DOWN;
  else if  ( val == 504 ) dir = LEFT;
  else if  ( val == 741 ) dir = SELECT;
  else  dir  = NONE; 



  if ( dir == UP )
  {
    seconds = counter += 1000;
    delay(1000);
  }
  else if (dir == DOWN)
  {
    seconds = counter -= 1000;
    delay(1000);
  }
  else if (dir == RIGHT)
  {
    seconds = counter += 100;
    delay(1000);
  }
  else if (dir == LEFT)
  {
    seconds = counter -= 100;
    delay(1000);
  }
  else if (dir == SELECT)
  {
   { void loop()
      
      stepper.step(STEPS/10);
      delay(seconds);
      }
  }



  lcd.setCursor(4, 1);
  lcd.print(seconds/1000);


}

the problem i have right now the fault in compieling is in this section of code

else if (dir == SELECT)
  {
   { void loop()
      
      stepper.step(STEPS/10);
      delay(seconds);
      }
  }

it says expected initializer before "stepper"

sorry if its a litle had to follow.

btw: both codes work great when there run seperatley :slight_smile: