Blink the LEDS when the motors are running

#include <DCMotorBot.h>
DCMotorBot bot;

const int ledPin=LED_BUILTIN;    // The number of the LED pin #13
int ledState=LOW;         // letState is low or off
unsigned long previousMillis=0; // Will store last time the LED was updated
const long interval=1000;  // How fast to blink the leds

void setup() {
  // put your setup code here, to run once:
  bot.setEnablePins(5,10);            // initialize bot pins
  bot.setControlPins(7,6,9,8);
  pinMode(ledPin, OUTPUT);           // Sets pin 13 as a output

}

void loop() {
                                         // This will blink the leds any
                                        // time the BOT is moving
  unsigned long currentMillis=millis();  
  if(currentMillis-previousMillis>=interval){ // Save the last time you blinked the leds
    previousMillis=currentMillis;      
    if(ledState==LOW){                // If the led is off then turn it on
      ledState=HIGH;                  // if the led is on turn it off
    }else{
      ledState=LOW;      
    }                                // This ends the else statement

digitalWrite(ledPin, ledState);    
  }                                 // this ends the time count
  

//   Start from home !!!!!!!
  
  bot.moveForward();    // Leg number 1
  delay(7000);
  bot.turnRight();     // Turn number 1
  delay(2800);
  bot.moveForward();   // Leg number 2
  delay(5000);
  bot.turnRight();    // Turn number 2
  delay(2800);
  bot.moveForward();  // Leg number 3
  delay(3500);
  bot.turnRight();    // Turn number 3
  delay(3000);
  bot.moveForward();  // Leg number 4
  delay(5000);
  bot.turnRight();    // Turn number 4
  delay(3000);
  bot.moveBackward();  // back to home
  delay(3500);

Newbe, just can’t seem to wrap my head around this. I can load the blink without delay and the LEDS blink just fine. Can load the Bot program and the Bot works just fine, but I just seem to make the two work together. I know that the " delays " in the Bot program with stop the LEDS. But what i’m trying to do is blink the Leds only when the Bot is moving. Very new to all this, can someone point me to what I’m doing wrong

  delay(7000);

Say NO to delay()

Save the time that you start moving and only start the next move when the required period has elapsed. Keep the loop() function running freely and you can blink LEDs to your heart's content using the BWOD principle during the movement.

Have not got as far as getting rid of the delays in the Bot program. I'm just learning, so I'm trying to keep it simple for right now. What I'm trying to figure out is how to run the BWOD for the LEDS and the motors at the same time. Or am I just over my head for right now? Of course I'm like every newbe and was hoping for a simple answer. I may have to do some more reading about what you are telling to do. I was looking at getting rid of the " delays " and using BWOD to set the motors run time.

If you use delays like you do, you will not be able to blink the LED's - but the delays are quite easy to get rid of..

const int DURATIONS[] = { 7000, 2800, 5000, 2800, 3500, 3000, 5000, 3000, 3500 };
unsigned long move_start = 0, move_duration = 0;
byte move_mode = 254;

...

void loop() {

  unsigned long loop_ms = millis();

  //Blink LED here
  
  if (loop_ms - move_start >= move_duration) {
    move_mode++;
    if (move_mode >= 8) move_mode = 0;
    move_start = loop_ms;
    move_duration = DURATIONS[move_mode];
    switch (move_mode) {
      case(0): bot.moveForward(); break;
      case(1): bot.turnRight(); break;
      case(2): bot.moveForward(); break;
      case(3): bot.turnRight(); break;
      case(4): bot.moveForward(); break;
      case(5): bot.turnRight(); break;
      case(6): bot.moveForward(); break;
      case(7): bot.turnRight(); break;
      case(8): bot.moveBackward(); break;
    }
  }
}

This will not block and should (with minor modifications) work nicely.

Ok thanks, not sure what all that means, but it gives me a place to start. What I do is look up each part of the line of code eg: " DURATIONS " and try to understand each part. And then go from there. The only part that scares me is (with minor modifications) part. But with some reading I hope it will work nicely.