I am so lost in what I am supposed to do in order to get the code onto my particle. This is my code:
Servo myServo;
int servoPin = A5;
int servoPos = 0;
void setup()
{
myServo.attach(A5);
Particle.function("servo", servoControl); //register Particle
Particle.variable("servoPos", &servoPos, INT); //keep cloud variable for current position
}
void loop()
{
}
int servoControl(String command)
{
//Convert
int newPos = command.toInt(); //Make sure it is in right range
servoPos = constrain(newPos, 0, 180); //set position
myServo.write(servoPos); //Set the Servo
return 1; //done
}
From what I have read, I need to somehow register my function but I’m not quite sure how? And what are the steps for after that in order to get everything to work?