Hi, I had a servo working on my Spark Core a few years ago, I just replaced it with a Photon and cannot get the servo to work.
The LED blinks perfectly but the servo doesn’t move. I have it attached to A0, 3v and GND as I had with Spark Core.
Below is my code snippet.
Any idea?
Thanks.
Phil
Servo myservo;
int pos = 0;
int startPos=45;
int endPos = 125;
bool swinging = false;
int queue = 0;
void setup()
{
Serial.begin(9600);
pinMode(D7, OUTPUT); // sets the pin as output
// Spark.function("kitty", swingArm);
}
void loop()
{
digitalWrite(D7, HIGH); // LED on
myservo.attach(A0);
myservo.write(endPos);
delay(300);
myservo.write(startPos);
delay(1000);
myservo.detach();
digitalWrite(D7, LOW); // LED off
delay (5000);
}