// 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