Hello all,
I am doing a project that takes potentiometer input and converts it to servo output, but I have run into a problem where the servos only move when the 'L' light is on, which prevents me from using a 9v battery to power the project.
#include <Servo.h> // servo library
// defing servos
Servo servo1;
Servo servo2;
//defing potentiometers
int pot1 = A0;
int pot2 = A1;
// pot variables
int potval1;
int potval2;
void setup(){
// attach servos
servo1.attach(9);
servo2.attach(8);
}
void loop(){
//pot reading
potval1 = analogRead(pot1);
potval1 = map(potval1, 0, 1023, 0, 360);
servo1.write(potval1);
delay(15);
potval2 = analogRead(pot2);
potval2 = map(potval2, 0, 1023, 0, 360);
servo2.write(potval2);
delay(15);
}
Any suggestions welcome.