Running 2 servos, stepper and color sensor

I'm currently doing a project that requires me to use 2 servos, a stepper and a color sensor. I currently have 2 Arduino Uno Controller boards but would like to only use one. I have codes for the stepper and servo but they only run on their own and I need them to run simultaneously. The stepper is connected to a power supply module.

Here's my sketch for the stepper:

int pin1 = 10;
int pin2 = 11;
int pin3 = 12;
int pin4 = 13;
boolean dir = false;
void setup()
{
// put your setup code here, to run once:
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
}
void loop()
{
switch(_step){
case 0:
digitalWrite(pin1, LOW);
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, HIGH);
break;
case 1:
digitalWrite(pin1, LOW);
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
break;
case 2:
digitalWrite(pin1, LOW);
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
break;
case 3:
digitalWrite(pin1, LOW);
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
break;
case 4:
digitalWrite(pin1, LOW);
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
break;
case 5:
digitalWrite(pin1, HIGH);
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
break;
case 6:
digitalWrite(pin1, HIGH);
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
break;
case 7:
digitalWrite(pin1, HIGH);
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, HIGH);
break;
default:
digitalWrite(pin1, LOW);
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
break;
}
if (dir){
_step++;
}else{
_step--;
}
if(_step>7){
_step=0;
}
if(_step<0){
_step=7;
}
delay(1);
}

Here's the sketch for the servo:

#include <Servo.h>

Servo servo; // create servo object to control a servo
int angle = 10;// twelve servo objects can be created on most boards

// variable to store the servo position

void setup () {

servo.attach(8); // attaches the servo on pin 9 to the servo object
servo.write(angle);

}

void loop() {
for (angle = 10; angle < 180; angle++)
{

servo.write(angle); // tell servo to go to position in variable 'pos'
delay(5); // waits 15ms for the servo to reach the position
}
for(angle = 180; angle > 10;angle--)
{
servo.write(angle);
delay(5);
}
}

I'm new at coding and this is my first time ever using Arduino. Any help is appreciated.

I haven't run servos with steppers but if you want to run multiple things at once you should look into Accelstepper library, I think it will be easier for you to code.

Their is a thread on google that shows using a stepper and servo at the same time that looks pretty straight forward to implement.
look here for code

@ElmiraShoara, to make it easy for people to help you please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Also please use the AutoFormat tool to indent your code for easier reading.

These links may help
Several Things at a Time

Stepper Motor Basics
Simple Stepper Code - especially the 2nd example
AccelStepper library

Planning and Implementing a Program

...R

int pin1 = 10;
int pin2 = 11;
int pin3 = 12;
int pin4 = 13;
boolean dir =  false;
void setup() 
{
  // put your setup code here, to run once:
  pinMode(pin1, OUTPUT);
  pinMode(pin2, OUTPUT);
  pinMode(pin3, OUTPUT);
  pinMode(pin4, OUTPUT);
}
void loop()
{
  switch(_step){
    case 0:
    digitalWrite(pin1, LOW);
    digitalWrite(pin2, LOW);
    digitalWrite(pin3, LOW);
    digitalWrite(pin4, HIGH);
    break;
    case 1:
    digitalWrite(pin1, LOW);
    digitalWrite(pin2, LOW);
    digitalWrite(pin3, HIGH);
    digitalWrite(pin4, HIGH);
    break;
     case 2:
    digitalWrite(pin1, LOW);
    digitalWrite(pin2, LOW);
    digitalWrite(pin3, HIGH);
    digitalWrite(pin4, LOW);
    break;
     case 3:
    digitalWrite(pin1, LOW);
    digitalWrite(pin2, HIGH);
    digitalWrite(pin3, HIGH);
    digitalWrite(pin4, LOW);
    break;
       case 4:
    digitalWrite(pin1, LOW);
    digitalWrite(pin2, HIGH);
    digitalWrite(pin3, LOW);
    digitalWrite(pin4, LOW);
    break;
       case 5:
    digitalWrite(pin1, HIGH);
    digitalWrite(pin2, HIGH);
    digitalWrite(pin3, LOW);
    digitalWrite(pin4, LOW);
    break;
       case 6:
    digitalWrite(pin1, HIGH);
    digitalWrite(pin2, LOW);
    digitalWrite(pin3, LOW);
    digitalWrite(pin4, LOW);
    break;
     case 7:
    digitalWrite(pin1, HIGH);
    digitalWrite(pin2, LOW);
    digitalWrite(pin3, LOW);
    digitalWrite(pin4, HIGH);
    break;
 default:
    digitalWrite(pin1, LOW);
    digitalWrite(pin2, LOW);
    digitalWrite(pin3, LOW);
    digitalWrite(pin4, LOW);
    break;  
  }
if (dir){
  _step++;
}else{
  _step--;
}
if(_step>7){
  _step=0;
}
if(_step<0){
  _step=7;
}
delay(1);
}


Here's the sketch for the servo:

#include <Servo.h>

Servo servo;  // create servo object to control a servo
int angle = 10;// twelve servo objects can be created on most boards

    // variable to store the servo position

void setup () {
  
  servo.attach(8);  // attaches the servo on pin 9 to the servo object
 servo.write(angle);
 
}

void loop() {
  for (angle = 10; angle < 180; angle++)
  {
  
    servo.write(angle);              // tell servo to go to position in variable 'pos'
    delay(5);                       // waits 15ms for the servo to reach the position
  }
  for(angle = 180; angle > 10;angle--)
  {
    servo.write(angle);
    delay(5);
  }
  }[pre][/pre]