Back to Parent

// myServoName.write(60);
int servoPin = A1;
Servo myservo;
int servoPosition = 0;


void setup() {
    myservo.attach(A1);
    Particle.function("servo", servoControl);
    Particle.variable( "servoPosition" , &servoPosition , INT );
}

void loop() {
    
}

int servoControl(String move){
    int newPosition = move.toInt();
    servoPosition = constrain( newPosition, 10 , 150);
    myservo.write( servoPosition );
    return 1;
}
Click to Expand

Content Rating

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

0