I'm new to the Arduino world and am working on a sketch to run a servo up and down with a spdt switch. My code is :
include #include<Servo.h>
int pos = 0;
Servo myservo;
void setup() {
pinMode(2, INPUT);
pinMode(3, INPUT);
myservo.attach(9);
}
void loop() {
if (digitalRead(2) == HIGH && pos < 180) {
pos++;
servo.write(pos);
delay(15);
}
if (digitalRead(3) == HIGH && pos > 0) {
pos--;
servo.write(pos);
delay(15);
}
}
When I compile I get the "unexpected primary-expression before ';' token" error with exit status 1.
What am I doing wrong???
myservoinstead ofservoin the blocks (to start with :).include #include<Servo.h>looks a bit screwy to me... ;)