problems programing DualMotor

#include <DualMotor.h>
#define VEZES 5
#define TOLERANCIA 0.90
#define TEMPO_ATUALIZACAO 200
#define A_ECHO_PIN 9
#define A_TRIG_PIN 10
#define F_ECHO_PIN 7
#define F_TRIG_PIN 8

DualMotor motores;
int maximo = 200; // Dist max = 200cm
int minimo = 0; // dist min = 0cm
long fDuracao, aDuracao, fDistancia, aDistancia, media;
boolean fManter;
void setup() {
Serial.begin(9600);
pinMode(A_TRIG_PIN, OUTPUT);
pinMode(A_ECHO_PIN, INPUT);

pinMode(F_TRIG_PIN, OUTPUT);
pinMode(F_ECHO_PIN, INPUT);

motores.M1parar();// pra o motor1
motores.M2parar();// ˆˆˆˆˆ^motor2

}

void loop() {
media = 0;
for(int i = 0; 1 < VEZES; i++) {
digitalWrite(F_TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(F_TRIG_PIN,HIGH);
delayMicroseconds(10);
digitalWrite(F_TRIG_PIN, LOW);
fDuracao = pulseIn(F_ECHO_PIN, HIGH);
media += fDuracao;
}
media = media / VEZES;
if (fDuracao<(media * TOLERANCIA))
fDuracao = media;
fDistancia = fDuracao / 58.4;
//Sensor atras :slight_smile:
media = 0;
for(int i = 0; i < VEZES; i ++) {
digitalWrite(A_TRIG_PIN,LOW);
delayMicroseconds(2);
digitalWrite(A_TRIG_PIN,HIGH);
delayMicroseconds(10);
digitalWrite(A_TRIG_PIN,LOW);
aDuracao=pulseIn(A_ECHO_PIN,HIGH);
media+=aDuracao;
}
media=media/VEZES;
if(aDuracao<(media*TOLERANCIA))
aDuracao=media;
aDuracao=aDuracao/58.4 ;
}

if (fDistancia>=maximo || fDistancia <= minimo) {
Serial.println(“frente: Fora de faixa”);
fManter = true;
}
else{
Serial.print(“Distancia frente : “);
Serial.print(fDistancia);
Serial.println(” cm”;
fManter = false;
}
if(aDistancia >=maximo || aDistancia <= minimo){
Serial.println(“atras: Fora de faixa”);
aManter = true;
}
else {
Serial.print(“Distancia atras : “);
Serial.print(aDistancia);
Serial.println(” cm”);
aManter = false;
}
Serial.println(" ");
if(!fManter)
{
if(fDistancia > 15)
{
motores.M1parar();
motores.M2move(100,0);
}
}
else {
motores.M1move(100,0);
motores.M2move(100,0);
}
delay (TEMPO_ATUALIZACAO);

}

ERROR MESSAGES :
Arduino: 1.8.1 (Mac OS X), Placa:“Arduino Nano, ATmega328”

sketch_apr08a:60: error: expected unqualified-id before ‘if’
if (fDistancia>=maximo || fDistancia <= minimo) {
^
sketch_apr08a:64: error: expected unqualified-id before ‘else’
else{
^
sketch_apr08a:70: error: expected unqualified-id before ‘if’
if(aDistancia >=maximo || aDistancia <= minimo){
^
sketch_apr08a:74: error: expected unqualified-id before ‘else’
else {
^
sketch_apr08a:80: error: ‘Serial’ does not name a type
Serial.println(" ");
^
sketch_apr08a:81: error: expected unqualified-id before ‘if’
if(!fManter)
^
exit status 1
expected unqualified-id before ‘if’

WHAT IS WRONG ?

Where is the end of your loop() function?

aarg:
Where is the end of your loop() function?

I've already corrected everything, thank you.

In future, use menu → tools → autoformat inthre the IDE to indent your code properly. That way it’s easy to find mismatches in curlies ( ‘{’ and ‘}’ ).

Also post your code using code tags.

Lastly this might or might not do what you expect

if(aDuracao<(media*TOLERANCIA))
      aDuracao=media;
      aDuracao=aDuracao/58.4 ;