Back to Parent

int servoPin = A3;
int servoPosition = 0;
Servo servo;

void setup()
{
  //Serial.begin( 9600 );
  //Particle.function( "pos", setPosition );
  servo.attach( servoPin );
}

void loop()
{
  for (servoPosition = 0; servoPosition <= 180; servoPosition+=1) {
      servo.write(servoPosition);
      delay(15);
  }
  for (servoPosition = 180; servoPosition >= 0; servoPosition-=1) {
      servo.write(servoPosition);
      delay(15);
  }
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0