Duas programação paralelas

Olá, meu nome é Michael sou novo tanto no forum quanto com projetos usando o arduino
e minha duvida é a seguinte:

  • eu tenho a programaçao de um carrinho (ele vai pra frente, vira, anda pra tras buzina etc…), e tenho também uma programação onde eu controlo 100% dele por bluetooth, mas eu gostaria de juntar os dois,
    gostaria que ele iniciasse no automatico e quando eu apertasse algum comando eu teria controle dele pelo bluetooth. Será que é possivel. POR FAVOR ME AJUDEM !!!
    vou postar aqui as duas programaçoes.

MODO AUTOMATICO:

int buzina = A5;
int frenteE = A1;
int trasE = A3;
int frenteD = A2;
int trasD = A4;
int setaD = 13;
int setaE = 12;
int farol = 11;

void setup()
{
pinMode(frenteD, OUTPUT);
pinMode(trasD, OUTPUT);
pinMode(frenteE, OUTPUT);
pinMode(trasE, OUTPUT);
pinMode(setaD, OUTPUT);
pinMode(setaE, OUTPUT);
pinMode(farol, OUTPUT);
pinMode(buzina, OUTPUT);
}

void loop()
{
digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, HIGH);
digitalWrite (trasD, LOW);
digitalWrite (trasE, LOW);
digitalWrite (farol, HIGH);
delay (2000);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, HIGH);
digitalWrite (trasD, HIGH);
digitalWrite (trasE, LOW);
digitalWrite (setaD, HIGH);
digitalWrite (setaE, LOW);
digitalWrite (farol, LOW);
digitalWrite (buzina, HIGH);
delay (10);

digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, HIGH);
digitalWrite (trasD, LOW);
digitalWrite (trasE, LOW);
digitalWrite (setaD, LOW);
digitalWrite (setaE, LOW);
digitalWrite (farol, HIGH);
digitalWrite (buzina, LOW);
delay (2000);

digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, LOW);
digitalWrite (trasE, HIGH);
digitalWrite (setaD, LOW);
digitalWrite (setaE, HIGH);
digitalWrite (farol, LOW);
digitalWrite (buzina, HIGH);
delay (10);

digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, HIGH);
digitalWrite (trasD, LOW);
digitalWrite (trasE, LOW);
digitalWrite (setaD, LOW);
digitalWrite (setaE, LOW);
digitalWrite (farol, HIGH);
digitalWrite (buzina, LOW);
delay (2000);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, LOW); //PARADA
digitalWrite (trasE, LOW);
digitalWrite (farol, LOW);
delay (100);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, HIGH);
digitalWrite (trasE, HIGH);
digitalWrite (farol, HIGH);
delay (2000);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, HIGH);
digitalWrite (trasD, HIGH);
digitalWrite (trasE, LOW);
digitalWrite (setaD, HIGH);
digitalWrite (setaE, LOW);
digitalWrite (farol, LOW);
digitalWrite (buzina, HIGH);
delay (10);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, HIGH);
digitalWrite (trasE, HIGH);
digitalWrite (setaD, LOW);
digitalWrite (setaE, LOW);
digitalWrite (farol, HIGH);
digitalWrite (buzina, LOW);
delay (2000);

digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, LOW);
digitalWrite (trasE, HIGH);
digitalWrite (setaD, LOW);
digitalWrite (setaE, HIGH);
digitalWrite (farol, LOW);
digitalWrite (buzina, HIGH);
delay (10);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, HIGH);
digitalWrite (trasE, HIGH);
digitalWrite (setaD, LOW);
digitalWrite (setaE, LOW);
digitalWrite (farol, HIGH);
digitalWrite (buzina, LOW);
delay (2000);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, LOW); // PARADA
digitalWrite (trasD, LOW);
digitalWrite (trasE, LOW);
digitalWrite (farol, LOW);
delay (1000);

digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, LOW);
digitalWrite (trasD, LOW); // 360
digitalWrite (trasE, HIGH);
delay (20);

digitalWrite (frenteD, HIGH);
digitalWrite (frenteE, HIGH);
digitalWrite (trasD, LOW);
digitalWrite (trasE, LOW);
digitalWrite (farol, HIGH);
delay (1000);

digitalWrite (frenteD, LOW);
digitalWrite (frenteE, LOW); // PARADA
digitalWrite (trasD, LOW);
digitalWrite (trasE, LOW);
digitalWrite (farol, LOW);
delay (1000);

for (int i = 0; i <= 10; i ++){
digitalWrite (farol, HIGH);
digitalWrite (setaD, HIGH);
digitalWrite (setaE, HIGH);
digitalWrite (buzina, HIGH);
delay (500);

digitalWrite (farol, LOW);
digitalWrite (setaD, LOW);
digitalWrite (setaE, LOW);
digitalWrite (buzina, LOW);
delay (500);
}

}


MODO BLUETOOTH:

char buffer[67];

byte Pino11 = 11;
byte Pino12 = 12;
byte Pino13 = 13;
byte PinoA0 = A0;
byte PinoA1 = A1;
byte PinoA2 = A2;
byte PinoA3 = A3;
byte PinoA4 = A4;
byte PinoA5 = A5;

void setup(){
Serial.begin(9600);
Serial.flush();
pinMode(Pino11, OUTPUT);
pinMode(Pino12, OUTPUT);
pinMode(Pino13, OUTPUT);
pinMode(PinoA0, OUTPUT);
pinMode(PinoA1, OUTPUT);
pinMode(PinoA2, OUTPUT);
pinMode(PinoA3, OUTPUT);
pinMode(PinoA4, OUTPUT);
pinMode(PinoA5, OUTPUT);
}
void loop(){
if (Serial.available()>0){
int index=0;
delay(100);//deixe o buffer encher
int numChar = Serial.available();
if(numChar>65){
numChar=65;
}
while(numChar–){
buffer[index++] = Serial.read();
}
splitString(buffer);
}
}
void splitString(char* data){
Serial.print(“Dados inseridos: “);
Serial.println(data);
char* parameter;
parameter= strtok (data, " ,”);
while(parameter != NULL){
setLED(parameter);
parameter = strtok (NULL, " ,”);
}
//Limpa o texto e os buffers seriais
for (int x=0; x<66; x++){
buffer=’\0’;
}
Serial.flush();
}
void setLED(char* data){

if ((data[0] ==‘j’) || (data[0] == ‘J’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,255);
analogWrite(Pino11, Ans);
Serial.print("Pino11 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘k’) || (data[0] == ‘K’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(Pino12, Ans);
Serial.print("Pino12 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘l’) || (data[0] == ‘L’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(Pino13, Ans);
Serial.print("Pino13 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘m’) || (data[0] == ‘M’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(PinoA0, Ans);
Serial.print("PinoA0 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘n’) || (data[0] == ‘N’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(PinoA1, Ans);
Serial.print("PinoA1 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘o’) || (data[0] == ‘O’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(PinoA2, Ans);
Serial.print("PinoA2 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘p’) || (data[0] == ‘P’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(PinoA3, Ans);
Serial.print("PinoA3 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘q’) || (data[0] == ‘Q’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(PinoA4, Ans);
Serial.print("PinoA4 esta em: ");
Serial.println(Ans);
}
if ((data[0] ==‘r’) || (data[0] == ‘R’)){
int Ans = strtol(data+1, NULL, 10);
Ans = constrain(Ans,0,1);
digitalWrite(PinoA5, Ans);
Serial.print("PinoA5 esta em: ");
Serial.println(Ans);
}
}

Code tags please.

Com todos esses delays é impossível...