Back to Parent

// Team Project
// Tian Li & Xinye Wang

int servoPin_01 = A4;
int servoPin_02 = A5;

Servo myServo_01;
Servo myServo_02;

void setup() {
    myServo_01.attach(servoPin_01);
    Particle.function("tail", handleMoveServo_01);

    myServo_02.attach(servoPin_02);
    Particle.function("hand", handleMoveServo_02);
}

int handleMoveServo_01(String cmd){
    if (cmd.toInt() > 215) {
        myServo_01.write(180);
        delay(1000);
        myServo_01.write(90);
        delay(1000);
        return 1;
    }
    return 0;
}

int handleMoveServo_02(String cmd){
    if (cmd.toInt()) {
        myServo_02.write(180);
        delay(2000);
        myServo_02.write(90);
        delay(2000);
        return 1;
    }
    return 0;
}

void loop() {

}
Click to Expand

Content Rating

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

0