I am unable to get a button on my arduino board to control a servo. I'd like the servo to rotate 90 degrees on button push, but it is unresponsive.
Is there a flaw in my code or is it wiring?
#include <Servo.h> // servo library
const int button1Pin = 2; // pushbutton 1 pin
Servo servo1; // servo control object
void setup()
{
pinMode(button1Pin, INPUT);
servo1.attach(9);
// Set servo 1 to output?
}
void loop()
{
int button1State;
int position;
button1State = digitalRead(button1Pin);
if (button1State == LOW);
{
servo1.write(90); // move servo
}
}