I don’t understand why is it coming again and again.
The error message is always ‘‘expected ‘)’ before ‘;’ token’’.
I don’t get that there is already a ‘)’ before ‘;’ so, why is it saying this over and over again on the last line.
void setup() {
pinMode (A0; OUTPUT); //VCC pin;
pinMode (A1; OUTPUT); //GND pin;
pinMode (A2; INPUT); // receives signal from sensor;
Serial.begin (9600);
}
// the loop routine runs over and over again;
void loop() {
digitalWrite (A0; HIGH);
digitalWrite (A1); LOW);
if () {
(analogRead(CM) < 5);
digitalWrite(8; HIGH); // provide high voltage to digital pin 8;
digitalWrite(9; LOW); //provide low voltage to digital pin 9;
}
}
You also have an if statement whose condition seems to have escaped into the next line. You should look at some example codes and try to learn the syntax.
int CM;
void setup() {
pinMode (A0, OUTPUT); //VCC pin;
pinMode (A1, OUTPUT); //GND pin;
pinMode (A2, INPUT); // receives signal from sensor;
Serial.begin (9600);
}
// the loop routine runs over and over again;
void loop() {
digitalWrite (A0, HIGH);
digitalWrite (A1, LOW);
if (analogRead(CM < 5)){
digitalWrite(8, HIGH); // provide high voltage to digital pin 8;
digitalWrite(9, LOW); //provide low voltage to digital pin 9;
}
}
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Because your "if" syntax is wrong in several ways. Do a little Googling ("c if statement") to understand the correct syntax for a c/c++ if/else statement.
The error message gives you the exact line number, and character position of the error...
if(distance <= 5); (
digitalWrite(8, HIGH); // output high voltage to digital pin 8;
);
else if(distance >= 5); (
digitalWrite(8, LOW); // output low voltage to digital pin 8;
);
Look up how if statements are constructed. Particularly the use of { } ( ) and ;
Function arguments are separated by commas, not semicolons.
Strings are delimited by double quotes, not single quotes
Statement-lists are surrounded by braces, not parenthesis.
If statements require a condition - an empty set of parenthesis is not admissable.