2 fuctions at the same time

guys
I have the remote car by bluetooth + arduino working fine, but when it goes back I’d like that the led blink. What do I do?

#include “SoftwareSerial.h”
#include <Servo.h>

int pinIn1=4; //motor1
int pinIn2=5; //motor1
int pinIn3=6; //motor2
int pinIn4=7; //motor2

SoftwareSerial bluetooth(2,3);
int entradaDados;

void setup() {

bluetooth.begin(9600);

pinMode(pinIn1, OUTPUT);
pinMode(pinIn2, OUTPUT);
pinMode(pinIn3, OUTPUT);
pinMode(pinIn4, OUTPUT);

pinMode(13, OUTPUT);

}

void loop() {
if (bluetooth.available() > 0) {
entradaDados = bluetooth.read();
if (entradaDados == ‘F’) {
Frente(); //Goes Forward
}
if (entradaDados == ‘R’) {
Retroceder(); //Goes Back

}
if (entradaDados == ‘D’) {
Direita(); //Goes Right
}
if (entradaDados == ‘E’) {
Esquerda(); //Goes Left
}
if (entradaDados == ‘P’) {
Parada(); //Stop
}
}
}

void Frente()
{
digitalWrite(pinIn1, HIGH);
digitalWrite(pinIn2, LOW);
digitalWrite(pinIn3, HIGH);
digitalWrite(pinIn4, LOW);
digitalWrite(13, HIGH);
}

void Retroceder(){
digitalWrite(pinIn1, LOW);
digitalWrite(pinIn2, HIGH);
digitalWrite(pinIn3, LOW);
digitalWrite(pinIn4, HIGH);
digitalWrite(13, HIGH);
delay(900);
digitalWrite(13, LOW);
delay(900);
digitalWrite(13, HIGH);
delay(900);
digitalWrite(13, LOW);
delay(900);
digitalWrite(13, HIGH);
delay(900);
digitalWrite(13, LOW);
delay(900);
}

void Direita(){
digitalWrite(pinIn1, LOW);
digitalWrite(pinIn2, HIGH);
digitalWrite(pinIn3, HIGH);
digitalWrite(pinIn4, LOW);
digitalWrite(13, LOW);
}

void Esquerda(){
digitalWrite(pinIn1, HIGH);
digitalWrite(pinIn2, LOW);
digitalWrite(pinIn3, LOW);
digitalWrite(pinIn4, HIGH);
digitalWrite(13, LOW);
}

void Parada(){
digitalWrite(pinIn1, HIGH);
digitalWrite(pinIn2, HIGH);
digitalWrite(pinIn3, HIGH);
digitalWrite(pinIn4, HIGH);
digitalWrite(13, LOW);
}

get rid of delay() and use millis() to do timing.

look here for references: millis() for beginners

If millis() will be working as delay() here why to use it?

surepic:
If millis() will be working as delay() here why to use it?

If coded correctly, won't be. OP needs to implement a State Machine.

Also worth observing - the use of tags was an admirable effort, but please use tags next time (or edit your original post!

The formatting is different when displayed - thanks

leandrogalves:
I have the remote car by bluetooth + arduino working fine, but when it goes back I'd like that the led blink. What do I do?

Have a look at how it is done in Several Things at a Time

You can't actually run two functions at the same time but you can make it appear like that by doing a little piece of each function interleaved with a little piece of the other function. Note how each function runs very briefly and returns to loop() so the next one can be called. Long running processes are achieved a tiny piece at a time. And there may be dozens of calls to some functions before it is actually time for anything to happen.

...R