Hi! I'am trying to build someting like this but my experiance is not enough! Can somebody pls help?

I am trying to do this with step motor and with rotary encoder controled menu but i have been keep failing and my other laptop broken . So my most of sketches are gone . My old sketch is still in dropbox but its not even close to complete and i dont have so much time. Pls someone can guide me?
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <ClickEncoder.h>
#include <TimerOne.h>

int menuitem = 1;
int frame = 1;
int page = 1;
int lastMenuItem = 1;

String menuItem1 = "CYCLES""times";
String menuItem2 = "X1 position" "mm";
String menuItem3 = "X2 position" "mm";
String menuItem4 = "X1 to X2 time" "mm/sn";
String menuItem5 = "X2 waiting time" "sn";
String menuItem6 = "X2 to X1 time" "mm/sn";
String menuItem7 = "X1 to wait time" "sn";

boolean backlight = true;
int contrast=40;
int CYCLES = 1;
int X1 = 1;
int X2 = 1;
int X1toX2 = 1;
int X2wait= 1;
int X2toX1 = 1;
int X1towait= 1;

boolean up = false;
boolean down = false;
boolean middle = false;

ClickEncoder *encoder;
int16_t last, value;

Adafruit_PCD8544 display = Adafruit_PCD8544( 5, 4, 3);

void setup() {
// put your setup code here, to run once:

encoder = new ClickEncoder(A1, A0, A2);
encoder->setAccelerationEnabled(false);
digitalWrite(7,HIGH);
display.begin();
display.clearDisplay();
Timer1.initialize(1000);
Timer1.attachInterrupt(timerIsr);

last = encoder->getValue();
}

void loop() {

drawMenu();

ClickEncoder::Button b = encoder->getButton();
if (b != ClickEncoder::Open) {
switch (b) {
case ClickEncoder::Clicked:
middle=true;
break;
}
}

if (up && page == 1 ) {

up = false;
if(menuitem==2 && frame ==2)
{
  frame--;
}

 if(menuitem==4 && frame ==4)
{
  frame--;
}
  if(menuitem==3 && frame ==3)
{
  frame--;
}
lastMenuItem = menuitem;
menuitem--;
if (menuitem==0)
{
  menuitem=1;
} 

}else if (up && page == 2 && menuitem==1 ) {
up = false;
CYCLES--;
}
else if (up && page == 2 && menuitem==2 ) {
up = false;
X1--;
}
else if (up && page == 2 && menuitem==3 ) {
up = false;
CYCLES--;
}
else if (up && page == 2 && menuitem==4 ) {
up = false;
X1toX2--;
}

if (down && page == 1) //We have turned the Rotary Encoder Clockwise
{

down = false;
if(menuitem==3 && lastMenuItem == 2)
{
  frame ++;
}else  if(menuitem==4 && lastMenuItem == 3)
{
  frame ++;
}
 else  if(menuitem==5 && lastMenuItem == 4 && frame!=4)
{
  frame ++;
}
lastMenuItem = menuitem;
menuitem++;  
if (menuitem==7) 
{
  menuitem--;
}

}else if (down && page == 2 && menuitem==1) {
down = false;
CYCLES++;
}
else if (down && page == 2 && menuitem==2) {
down = false;
X1++;
}
else if (down && page == 2 && menuitem==3 ) {
down = false;
X2++;
if(X2 == 999)
{
X2 = 0;
}
}
else if (down && page == 2 && menuitem==4 ) {
down = false;
X1toX2++;
if(X1toX2 == 999)
{
X2wait = 0;
}
}

if (middle) //Middle Button is Pressed
{
middle = false;

if (page == 1 && menuitem==5) // Backlight Control 
{else if (down && page == 2 && menuitem==4 ) {
down = false;
X1toX2++;
if(X1toX2 == 999)
{
  X2wait = 0;
}

if(page == 1 && menuitem ==6)// Reset
{
  resetDefaults();
}


else if (page == 1 && menuitem<=4) {
  page=2;
 }
  else if (page == 2) 
 {
  page=1; 
 }

}
}

void drawMenu()
{

if (page==1)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print("MAIN MENU");
display.drawFastHLine(0,10,83,BLACK);

if(menuitem==1 && frame ==1)
{   
  displayMenuItem(menuItem1, 15,true);
  displayMenuItem(menuItem2, 25,false);
  displayMenuItem(menuItem3, 35,false);
}
else if(menuitem == 2 && frame == 1)
{
  displayMenuItem(menuItem1, 15,false);
  displayMenuItem(menuItem2, 25,true);
  displayMenuItem(menuItem3, 35,false);
}
else if(menuitem == 3 && frame == 1)
{
  displayMenuItem(menuItem1, 15,false);
  displayMenuItem(menuItem2, 25,false);
  displayMenuItem(menuItem3, 35,true);
}
 else if(menuitem == 4 && frame == 2)
{
  displayMenuItem(menuItem2, 15,false);
  displayMenuItem(menuItem3, 25,false);
  displayMenuItem(menuItem4, 35,true);
}

  else if(menuitem == 3 && frame == 2)
{
  displayMenuItem(menuItem2, 15,false);
  displayMenuItem(menuItem3, 25,true);
  displayMenuItem(menuItem4, 35,false);
}
else if(menuitem == 2 && frame == 2)
{
  displayMenuItem(menuItem2, 15,true);
  displayMenuItem(menuItem3, 25,false);
  displayMenuItem(menuItem4, 35,false);
}

else if(menuitem == 5 && frame == 3)
{
  displayMenuItem(menuItem3, 15,false);
  displayMenuItem(menuItem4, 25,false);
  displayMenuItem(menuItem5, 35,true);
}

else if(menuitem == 6 && frame == 4)
{
  displayMenuItem(menuItem4, 15,false);
  displayMenuItem(menuItem5, 25,false);
  displayMenuItem(menuItem6, 35,true);
}

  else if(menuitem == 5 && frame == 4)
{
  displayMenuItem(menuItem4, 15,false);
  displayMenuItem(menuItem5, 25,true);
  displayMenuItem(menuItem6, 35,false);
}
  else if(menuitem == 4 && frame == 4)
{
  displayMenuItem(menuItem4, 15,true);
  displayMenuItem(menuItem5, 25,false);
  displayMenuItem(menuItem6, 35,false);
}
else if(menuitem == 3 && frame == 3)
{
  displayMenuItem(menuItem3, 15,true);
  displayMenuItem(menuItem4, 25,false);
  displayMenuItem(menuItem5, 35,false);
}
    else if(menuitem == 2 && frame == 2)
{
  displayMenuItem(menuItem2, 15,true);
  displayMenuItem(menuItem3, 25,false);
  displayMenuItem(menuItem4, 35,false);
}
else if(menuitem == 4 && frame == 3)
{
  displayMenuItem(menuItem3, 15,false);
  displayMenuItem(menuItem4, 25,true);
  displayMenuItem(menuItem5, 35,false);
}   
display.display();

}
else if (page==2 && menuitem == 1)
{
displayIntMenuPage(menuItem1, contrast);
}

else if (page==2 && menuitem == 2)
{
displayIntMenuPage(menuItem2, X1);
}
else if (page==2 && menuitem == 3)
{
displayStringMenuPage(menuItem3, X2);
}
else if (page==2 && menuitem == 4)
{
displayStringMenuPage(menuItem4, X1toX2);
}
else if (page==2 && menuitem == 4)
{
displayStringMenuPage(menuItem4,X1toX2]);
}

}

void timerIsr() {
encoder->service();
}
}

void displayMenuItem(String item, int position, boolean selected)
{
if(selected)
{
display.setTextColor(WHITE, BLACK);
}else
{
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, position);
display.print(">"+item);
}
void timerIsr() {
encoder->service();
}
void displayIntMenuPage(String menuItem, int value)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(menuItem);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(5, 15);
display.print("Value");
display.setTextSize(2);
display.setCursor(5, 25);
display.print(value);
display.setTextSize(2);
display.display();
}

void displayStringMenuPage(String menuItem, String value)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(menuItem);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(5, 15);
display.print("Value");
display.setTextSize(2);
display.setCursor(5, 25);
display.print(value);
display.setTextSize(2);
display.display();
}
void displayMenuItem(String item, int position, boolean selected)
{
if(selected)
{
display.setTextColor(WHITE, BLACK);
}else
{
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, position);
display.print(">"+item);
}

void readRotaryEncoder()
{
value += encoder->getValue();

if (value/2 > last) {
last = value/2;
down = true;
delay(50);
}else if (value/2 < last) {
last = value/2;
up = true;
delay(50);
}
}

Please take a good look at the first topic telling how to get the best from this forum. Note how to use code tags for posting code. Also note the demands for documentation like schematics and a good project description.

btw i dont need multi axis. only up &down :frowning:

Could you maybe comment the code, so we have an idea what it is supposed to do?

Why such heavy use of Strings?

sorry I'm just too frustrated. So when i see project guidance i just cant stop myself!

Take it easy and keep Your feet on the ground. You do the work, we look at it and give advice for the next steps.

I'am tying to do this with one axis. As for servo motor step motor

well i am new in arduino and still trying to learn it so there might be a lot of mistakes. Like heavy use of strings :slight_smile:

The link You provide points at an entire project. Most helpers don't have the time needed to penetrate all that material.
Helpers also have private life that contains more than helping members here in forum.
The more work You do the faster helpers respond.

Or indeed, any use of "String"s. :roll_eyes:

Yeah. i know. i just dont know what to do. if i asked too much i am sorry. But right know what i am asking is the menu with encoder control. i write some of the codes up some points and i am taking some errors . i fixed some of them but not all so that is a little bit boring. Let me take it from the start. I'm using 5110 LCD screen, encoder button, nema 17 step motor and ZM-2H504 step motor driver. when i am trying to build a menu for that its just keep crashing.

Try this: Make a menu only sketch.
Skip all hardware and make the basic menu handler. Let the menu handler call dummy functions like "move stepper", "write to LCD" etc.
When that works, replace the dummy functions with sharp, hardware functions.
Else You will find Yourself lost in a spagetti.
No project like this is like a baby jigsaw, just put down pieces where they fit, and, voila, it works.
Divide the project in parts and attack the parts one by one.

Editing your first post to correctly display the code, correctly indented using "Auto Format" (Control T in the IDE) would be an excellent start!

hi. Sorry for late return. i did as you said but now i am having problem with running step motor. Is there a problem with the code?
void tekrar(){
if (abs(CYCLES>0)) {
stepper.moveTo(x1mm100);
stepper.setMaxSpeed(x1x2
10);
delay(x2wait100);
stepper.moveTo(-x2mm
100);
stepper.setMaxSpeed(x2x110);
delay(x1wait
100);
CYCLES--;
if (CYCLES >0) {

tekrar();
}

}
}

And I am having problem to figure anything out from that statement.

Why not set maxSpeed before calling moveTo?

stepper.setMaxSpeed(x1x210);
stepper.moveTo(x1mm100);
delay(x2wait100);
stepper.setMaxSpeed(x2x110);
stepper.moveTo(-x2mm100);

i change it but still same. step motor not moving at all

i tryed moveTo or move but not moving. with diffrent code step motor working but not with this code. when i start the code it enter the void tekrar and after few sec. cycles drop to 0 but step motor not moving
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <ClickEncoder.h>
#include <TimerOne.h>
#include <AccelStepper.h>

int menuitem = 1;
int frame = 1;
int page = 1;
int lastMenuItem = 1;
AccelStepper stepper(1, A4, A3);
String menuItem1 = "CYCLES";
String menuItem2 = "X1 position";
String menuItem3 = "X2 position";
String menuItem4 = "X1toX2 time";
String menuItem5 = "X2 wait";
String menuItem6 = "X2toX1 time";
String menuItem7 = "X1 wait ";
String menuItem8 = "START";

int x1mm = 10;
int CYCLES =3;
int x1x2 = 10;
int x2wait = 10 ;
int x2x1 = 10 ;
int x1wait = 10 ;
int x2mm = 10;
const int buttonPin = 2 ;
const int LimitSwitch_1 = 8; //Input for the limit switch
const int LimitSwitch_2 = 9; //Input for the limit switch

bool stepperMaxSpeed_Selected = false; //for setMaxSpeed
bool stepperSpeed_Selected = false; //for setSpeed
bool stepperSpeedRun = false; //for "indefinite" running
bool stepperAcceleration_Selected = false; //for setAcceleration
bool stepperAbsoluteSteps_Selected = false; //moveTo()
bool stepperRelativeSteps_Selected = false; //move()
bool rotaryStepping_Selected = false; //precisely step the motor with the rotary encoder
bool buttonStepping_Selected = false; //precisely step the motor with the buttons (UpButton/DownButton)
bool stepperStepsize_Selected = false; //Step size menu
bool stepperSetZero_Selected = false; //Reset to 0 menu
bool stepperGoTo_Selected = false; //Go To function
bool pingpongStep_Selected = false; //ping-pong demo function - based on steps
bool pingpongStep_Enabled = false; //step-based ping pong demo enable/disable swtich
bool pingpongLimit_Selected = false; //ping pong demo function - based on limit switch
bool pingpongLimit_Enabled = false; //limitswitch based pingpongdemo
bool stepperhoming_Selected = false; //Homing with limit switch
bool menuChanged = false; //Switched between menus
bool valueChanged = false; //changed the value of a menu item
bool updateValueSelection = false; //if we want to change the value of a variable, it becomes true
bool pingpong_CW = false; //keeps track of the direction inside the limit switch-based pingpong
bool pingpong_CCW = false; //keeps track of the direction inside the limit switch-based pingpong

boolean backlight = true;
int contrast=40;
boolean buttonState = LOW;
boolean up = false;
boolean down = false;
boolean middle = false;

ClickEncoder *encoder;
int16_t last, value;

Adafruit_PCD8544 display = Adafruit_PCD8544(13,11,5, 4, 3);

void setup() {
stepper.setMaxSpeed(2000);
pinMode(7,OUTPUT);
turnBacklightOn();
pinMode(buttonPin, INPUT);
encoder = new ClickEncoder(A1, A0, A2);
encoder->setAccelerationEnabled(false);

display.begin();
display.clearDisplay();
setContrast();
buttonState = digitalRead(buttonPin);
Timer1.initialize(1000);
Timer1.attachInterrupt(timerIsr);

last = encoder->getValue();
}

void loop() {

drawMenu();

readRotaryEncoder();

ClickEncoder::Button b = encoder->getButton();
if (b != ClickEncoder::Open) {
switch (b) {
case ClickEncoder::Clicked:
middle=true;
break;
}
}

if (up && page == 1 ) {

up = false;
if(menuitem==2 && frame ==2)
{
  frame--;
}

 if(menuitem==4 && frame ==4)
{
  frame--;
}
if(menuitem==5 && frame ==5)
{
  frame--;
}

if(menuitem==6 && frame ==6)
{
frame--;
}
if(menuitem==7 && frame ==7)
{
frame--;
}
if(menuitem==8 && frame ==8)
{
frame--;
}

  if(menuitem==3 && frame ==3)
{
  frame--;
}
lastMenuItem = menuitem;
menuitem--;
if (menuitem==0)
{
  menuitem=1;
} 

}else if (up && page == 2 && menuitem==1 ) {
up = false;
CYCLES--;
if (CYCLES <1){
CYCLES=1;
}
}
else if (up && page == 2 && menuitem==2 ) {
up = false;
x1mm--;
if (x1mm <1){
x1mm=1;
}
}
else if (up && page == 2 && menuitem==3 ) {
up = false;
x2mm--;
if (x2mm<1){
x2mm=1;
}}
else if (up && page == 2 && menuitem==4 ) {
up = false;
x1x2--;

}
else if (up && page == 2 && menuitem==5 ) {
up = false;
x2wait--;

}
else if (up && page == 2 && menuitem==6 ) {
up = false;
x2x1--;

}
else if (up && page == 2 && menuitem==7 ) {
up = false;
x1wait--;

}

if (down && page == 1) //We have turned the Rotary Encoder Clockwise
{

down = false;
if(menuitem==3 && lastMenuItem == 2)
{
  frame ++;
}else  if(menuitem==4 && lastMenuItem == 3)
{
  frame ++;
}
 else  if(menuitem==5 && lastMenuItem == 4 && frame!=4)
{
  frame ++;
}
 else  if(menuitem==6 && lastMenuItem == 5 && frame!=5)
{
  frame ++;
} else  if(menuitem==7 && lastMenuItem == 6 && frame!=6)
{
  frame ++;
} else  if(menuitem==8 && lastMenuItem == 7 && frame!=6)
{

}
lastMenuItem = menuitem;
menuitem++;  
if (menuitem==9) 
{
  menuitem--;
}

}else if (down && page == 2 && menuitem==1) {
down = false;
CYCLES++;
}
else if (down && page == 2 && menuitem==2) {
down = false;
x1mm++;
}
else if (down && page == 2 && menuitem==3 ) {
down = false;
x2mm++;
}
else if (down && page == 2 && menuitem==4 ) {
down = false;
x1x2++;

}
else if (down && page == 2 && menuitem==5 ) {
down = false;
x2wait++;

}
else if (down && page == 2 && menuitem==6 ) {
down = false;
x2x1++;

} else if (down && page == 2 && menuitem==7 ) {
down = false;
x1wait++;

}

if (middle) //Middle Button is Pressed
{
middle = false;

if(page == 1 && menuitem ==8){

tekrar();
}

else if (page == 1 && menuitem<=8) {
  page=2;
 }
  else if (page == 2) 
 {
  page=1; 
 }

}
}

void drawMenu()
{

if (page==1)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print("MAIN MENU");
display.drawFastHLine(0,10,83,BLACK);

if(menuitem==1 && frame ==1)
{   
  displayMenuItem(menuItem1, 15,true);
  displayMenuItem(menuItem2, 25,false);
  displayMenuItem(menuItem3, 35,false);
}
else if(menuitem == 2 && frame == 1)
{
  displayMenuItem(menuItem1, 15,false);
  displayMenuItem(menuItem2, 25,true);
  displayMenuItem(menuItem3, 35,false);
}
else if(menuitem == 3 && frame == 1)
{
  displayMenuItem(menuItem1, 15,false);
  displayMenuItem(menuItem2, 25,false);
  displayMenuItem(menuItem3, 35,true);
}
 else if(menuitem == 4 && frame == 2)
{
  displayMenuItem(menuItem2, 15,false);
  displayMenuItem(menuItem3, 25,false);
  displayMenuItem(menuItem4, 35,true);
}

  else if(menuitem == 3 && frame == 2)
{
  displayMenuItem(menuItem2, 15,false);
  displayMenuItem(menuItem3, 25,true);
  displayMenuItem(menuItem4, 35,false);
}
else if(menuitem == 2 && frame == 2)
{
  displayMenuItem(menuItem2, 15,true);
  displayMenuItem(menuItem3, 25,false);
  displayMenuItem(menuItem4, 35,false);
}
else if(menuitem == 2 && frame == 2)
{
  displayMenuItem(menuItem2, 15,true);
  displayMenuItem(menuItem3, 25,false);
  displayMenuItem(menuItem4, 35,false);
}


else if(menuitem == 5 && frame == 3)
{
  displayMenuItem(menuItem3, 15,false);
  displayMenuItem(menuItem4, 25,false);
  displayMenuItem(menuItem5, 35,true);
}

else if(menuitem == 3 && frame == 3)
{
displayMenuItem(menuItem3, 15,true);
displayMenuItem(menuItem4, 25,false);
displayMenuItem(menuItem5, 35,false);
}
else if(menuitem == 4 && frame == 3)
{
displayMenuItem(menuItem3, 15,false);
displayMenuItem(menuItem4, 25,true);
displayMenuItem(menuItem5, 35,false);
}
else if(menuitem == 6 && frame == 4)
{
displayMenuItem(menuItem4, 15,false);
displayMenuItem(menuItem5, 25,false);
displayMenuItem(menuItem6, 35,true);
}

  else if(menuitem == 5 && frame == 4)
{
  displayMenuItem(menuItem4, 15,false);
  displayMenuItem(menuItem5, 25,true);
  displayMenuItem(menuItem6, 35,false);
}
  else if(menuitem == 4 && frame == 4)
{
  displayMenuItem(menuItem4, 15,true);
  displayMenuItem(menuItem5, 25,false);
  displayMenuItem(menuItem6, 35,false);
}
else if(menuitem == 7 && frame == 5)
{
  displayMenuItem(menuItem5, 15,false);
  displayMenuItem(menuItem6, 25,false);
  displayMenuItem(menuItem7, 35,true);
}   
else if(menuitem == 6 && frame == 5)
{
   displayMenuItem(menuItem5, 15,false);
  displayMenuItem(menuItem6, 25,true);
  displayMenuItem(menuItem7, 35,false);
} 

else if(menuitem == 5 && frame == 5)
{
displayMenuItem(menuItem5, 15,true);
displayMenuItem(menuItem6, 25,false);
displayMenuItem(menuItem7, 35,false);
}
else if(menuitem == 8 && frame == 6)
{
displayMenuItem(menuItem6, 15,false);
displayMenuItem(menuItem7, 25,false);
displayMenuItem(menuItem8, 35,true);
}
else if(menuitem == 7 && frame == 6)
{
displayMenuItem(menuItem6, 15,false);
displayMenuItem(menuItem7, 25,true);
displayMenuItem(menuItem8, 35,false);
}
else if(menuitem == 6 && frame == 6)
{
displayMenuItem(menuItem6, 15,true);
displayMenuItem(menuItem7, 25,false);
displayMenuItem(menuItem8, 35,false);
}

display.display();

}
else if (page==2 && menuitem == 1)
{
displayIntMenuPage(menuItem1, CYCLES);
}

else if (page==2 && menuitem == 2)
{
displayIntMenuPage(menuItem2, x1mm);
}
else if (page==2 && menuitem == 3)
{
displayIntMenuPage(menuItem3, x2mm);
}
else if (page==2 && menuitem == 4)
{
displayIntMenuPage(menuItem4, x1x2);
}
else if (page==2 && menuitem == 5)
{
displayIntMenuPage(menuItem5, x2wait);
}
else if (page==2 && menuitem == 6)
{
displayIntMenuPage(menuItem6, x2x1);
}
else if (page==2 && menuitem == 7)
{
displayIntMenuPage(menuItem7, x1wait);
}
else if (page==2 && menuitem == 8)
{

}
}

void setContrast()
{
display.setContrast(contrast);
display.display();
}
void turnBacklightOn()
{
digitalWrite(7,HIGH);
}

void timerIsr() {
encoder->service();
}
void displayIntMenuPage(String menuItem, int value)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(menuItem);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(5, 15);
display.print("Value");
display.setTextSize(2);
display.setCursor(5, 25);
display.print(value);
display.setTextSize(2);
display.display();
}
void displayStringMenuPage(String menuItem, String value)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(menuItem);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(5, 15);
display.print("Value");
display.setTextSize(2);
display.setCursor(5, 25);
display.print(value);
display.setTextSize(2);
display.display();
}

void tekrar(){
if (abs(CYCLES>0)) {
stepper.setMaxSpeed(200);
stepper.move(x1mm100);
delay(x2wait
100);
stepper.setMaxSpeed(200);
stepper.move(-x2mm100);
delay(x1wait
100);
CYCLES--;
if (CYCLES >0) {

tekrar();
}

}
}
void readRotaryEncoder()
{
value += encoder->getValue();

if (value/2 > last) {
last = value/2;
up = true;
delay(150);
}else if (value/2 < last) {
last = value/2;
down = true;
delay(150);
}
}

void displayMenuItem(String item, int position, boolean selected)
{
if(selected)
{
display.setTextColor(WHITE, BLACK);
}else
{
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, position);
display.print(">"+item);
}

i can use led in cycles but not step motor.

Can You please practise using code tags? Your post is rather heavy to handle as it is, using novells of code.

What have You done to loose the motor function? The question was how to make a menu.

Make a sketch for developing the menu You want.
Make a sketch running the motor.