Hi, I'm new in robotics, start with an Arduino Uno, and can't find my error in my program:
//Arduino Uno goes backward when you approach at the front
//Ultrasound Sensor 1 (beam 60o) mounted at the front and in Mode 2 (automatic)
//PWMUS1 is input US 1 (lateron I want more sensors), DCLpin = relay left motor, DCRpin = relay right motor
//KAwaarde is value to determine whether the approacher is at less than 1 meter
int PWMUS1 = 4;
int DCLpin = 5;
int DCRpin = 6;
int KAwaarde8;
void setup()
{
Serial.begin(9600); //Serie zetten op 9600 bytes per sec
pinMode (PWMUS1, INPUT);
pinMode (DCLpin, OUTPUT);
pinMode (DCRpin, OUTPUT);
}
void loop ()
{
int KAwaarde8;
KAwaarde8 = analogRead(PWMUS1);
{
if KAwaarde8 <= 51
int motorBackward();
digitalWrite(DCLpin, HIGH);
digitalWrite(DCRpin, HIGH);
delay (1000);
}
}
It keeps saying:
sketch_mar26a.cpp: In function 'void loop()':
sketch_mar26a:26: error: expected `(' before 'KAwaarde8'
What's wrong, someone can help me?