It is done. Our servo can now be controlled by a potentiometer. This gives us so much freedom when trying the move the crane about the Z axis. It is now manually controlled rather than it moving based off of a timer.
THE FINAL CODE
#include <Servo.h>
Servo myservo;
int potpin = 0;
int val;
void setup()
{
myservo.attach(9);
}
void loop()
{
val = analogRead(potpin);
val = map(val, 0, 1023, 0, 179);
myservo.write(val);
delay(15);
}
No comments:
Post a Comment