I am having these errors: In function 'void loop()':
error: expected ')' before ';' token
error: expected primary-expression before ')' token
error: expected ';' before ')' token
error: expected ';' before ')' token
expected ')' before ';' token
Here is the code
#include <Servo.h>
//#include <LiquidCrystal.h>
Servo myservo;
int pos = 0;
void setup() {
myservo.attach(12);
}
void loop() {
for (pos = 0; pos <= 180; pos += 1)
(
myservo.write(pos) ;
delay(50);
)
for (pos = 180; pos >= 0; pos -= 1)
{
myservo.write(pos);
delay(50);
}
}
void loop() {
for (pos = 0; pos <= 180; pos += 1)
(
myservo.write(pos) ;
delay(50);
)
You can't just use braces {} and parentheses () randomly. You need the right ones in the right places.
Steve
So you guys are saying that I should get rid of the brackets?
They're saying that you must understand that there is a difference between ( and { and between ) and }.
singhsimar486:
So you guys are saying that I should get rid of the brackets?
We're saying a bracket is not just any old bracket. In fact the technical terms are bracket [], brace {} and parenthesis () - or if you want to be less technical square bracket [], round bracket () and curly bracket {}. And they all have different meanings when writing programs.
You've got round ones where you should have curly ones and since they mean something different the compiler is complaining.
Steve