Brush Command lagging program

Hello, so I have an issue where a single line of code is lagging my entire program.
I have the stepper library and everything. Here is the line of code:

brush.step(-stepsPerRevolution);

Where brush is the name I gave my stepper motor (It is turning a brush).
When it gets to this line, it freezes for about 3-5 seconds, and then continues, but if I press a programmed switch, then when it gets to this line, it goes no further. It just stalls. Why would this be?
Here is my loop, if it helps... All of these functions are declared, and the Serial.println's are all for debugging, that's how I found which line was lagging.

void loop() {
  Serial.println("Began Loop");
  brushSpeed=15;
  fDrive(215, 75);
  swLeft = digitalRead(0);
  swRight = digitalRead(3);
  if (swLeft == LOW) {
    blockageLeft(1);
  }
  if (swRight == LOW) {
    blockageRight(1);
  }
  Serial.println("Test Point 1");
  brush.setSpeed(brushSpeed); //RPMs equal brushSpeed integer
  Serial.println("Test Point 2");
  brush.step(-stepsPerRevolution);
  Serial.println("Ended Loop");
}

Thank you!!!
---Sky777

***If you need to view the whole code, view my reply below.

What gave You the idea that posting a snippet would be satisfactory?

Please read and follow this link: How to get the best out of this forum - Using Arduino / Project Guidance - Arduino Forum

Telling posters this over and over again is annoying. Why are so few reading the advise given?

Because I don't want to take up a whole page with one code block, whether it's minimized or not. But if it bugs you that much, I'll put the file and the code block in, give me a few minutes.

#include <Stepper.h>  //Include library for the Stepper motor. This is the default Library that comes with Arduino.

const int stepsPerRevolution = 2048;  //Number of steps per revolution (2048 --- 64:1 Gear ratio, 32 initial steps per revolution... 32*64==2048)
const int ENB = 5;                   //Enable side B
const int ENA = 6;                   //Enable side A
const int IN1 = 11;                  //Init #1
const int IN2 = 9;                   //Init #2
const int IN3 = 8;                   //Init #3
const int IN4 = 7;                   //Init #4

//IN1-IN4 I reversed the pin numbers, because that is how they are shown on the board.

//Variable Integers:
int brushSpeed;  //The speed of the brush
int swLeft;      //These switches are ordered from left to right when the bot is facing away from you.
int swRight;

Stepper brush(stepsPerRevolution, 4, 12, 10, 13);

void lTurn(int speed, int length) {  //Turn left
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  delay(length);
}

void rTurn(int speed, int length) {  //Turn right
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  delay(length);
}

void fDrive(int speed, int length) {  //Drive forwards
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  delay(length);
}

void bDrive(int speed, int length) {  //Drive backwards
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  delay(length);
}

void brake(int length) {  //Stop moving
  digitalWrite(ENA, LOW);
  digitalWrite(ENB, LOW);
  delay(length);
}

//New Functions:
void blockageLeft(int numTrigger) {  //In the event of an object blocking the robot's path on the left side:
  if (numTrigger == 1) {
  Serial.println("Began Left Blockage");
  brushSpeed=0;
  brake(20);
  bDrive(255, 1500);
  rTurn(255, 650);
  Serial.println("Ended Left Blockage");
  }
}

void blockageRight(int numTrigger) {  //In the event of an object blocking the robot's path on the right side
  if (numTrigger == 1) {
    Serial.println("Began Right Blockage");
    brushSpeed=0;
    brake(20);
    bDrive(255, 1500);
    lTurn(255, 650);
    Serial.println("Ended Right Blockage");
  }
}

void setup() {

  pinMode(IN1, OUTPUT);  //To declare each pin an input or output
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);
  pinMode(0, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  Serial.begin(9600);
}

void loop() {
  Serial.println("Began Loop");
  brushSpeed=15;
  fDrive(215, 75);
  swLeft = digitalRead(0);
  swRight = digitalRead(3);
  if (swLeft == LOW) {
    blockageLeft(1);
  }
  if (swRight == LOW) {
    blockageRight(1);
  }
  Serial.println("Test Point 1");
  brush.setSpeed(brushSpeed); //RPMs equal brushSpeed integer
  Serial.println("Test Point 2");
  brush.step(-stepsPerRevolution);
  Serial.println("Ended Loop");
}

Robot_Vacuum_Offline.ino (3.2 KB)

Is the stepper moving or not during that time frame?

What would that be? I've never heard about programming switches, buttons etc.

Show a chart showing the flow of the code. Usually called flow chart. That gives an overview of the system.

Setting speed to 0 looks like a reason for no more move.

If You know better then I, why do You post a question at all? You have still not been reading the advice linked to You. Why else are You posing a link to a .INO file? No helper enjoys using disk space for newbie files, other helpers steps to the next member's question.

Why not follow posting instructions and explain what you have connected the Arduino, and what you expect it to do?

Your code contains a peculiar combination of commands to (apparently) a brushed DC motor driver, a stepper and some other things, and you do not appear to be using the stepper library correctly.

Please read and follow the instructions in the "How to get the best out of the forum" post, linked at the head of every forum category.

Yes, the stepper is moving during that time frame.
Sorry, when I said programmed switches, I just meant that I had given those switches a function, not like the switches themselves are programmed.
I don't have a program for creating flow charts, I suppose I could draw one by have, but I don't believe that would be much help for you...
And by the way, the "rules" did say that I could post a coffee block or the .ino file, so I did BOTH, trying to make you folks happy...

Ok, then how am I supposed to use the library? Considering I incorporated the library from the Stepper motor example...
And I didn't figure I had to write an essay on what is connected and what it all should do, that seems somewhat unnecessary...

And that is why we like to see the entire sketch - brushSpeed gets set to 0 in blockageLeft and blockageRight, so the brush.step() that follows in loop() will take forever to execute.

Ahhh, dangit. Good point. I did not remember that I set it to 0 in the blockageRight/Left when I used the last setSpeed, thank you!
But even after I change this, it still lags at that line. Why is that?

Use pen and paper. There's no program that reads Your mind.

Then You have misunderstood things.

No, don't write novells. Word sallad only causes confusion.

How on earth do You think people not standing behind You would know?

We are not mind readers.

You use much efforts avoiding following advice, answering questions.
I will not spend more time on Your question, guessing.
Good luck.
Over and out.

Which Arduino, motor, driver, library? How is each component wired to the others?

step() is a blocking function, it will return after the stepper motor has moved the number of steps specified in the function call. The more steps, and the slower the step speed, the longer it will take.

Yes, this is what I figured out, I am not using the Stepper now because of it, thank you (and thank you to the others who helped me out with the blocking part of the function as well)