setServoAngle(id,angle,times)

Control the servo motor to rotate to a specified angle (non-blocking)

Parameter

Example

Use uKit Explore v2 board to control the servo motor ID-1 to rotate to 30 ° within 400ms, then to -30 ° within 400ms

#include "uKitExplore.h"
void setup() {    
    Initialization();
    
}

void loop() {    
    setServoAngle(1,30,400);    
    delay(400);    
    setServoAngle(1,-30,400);    
    delay(400);
}

Use uKit Explore v2 board to simultaneously control the servos ID-1 and ID-2 to rotate to 30 ° within 400ms, and then to -30 ° within 400ms at the same time.

#include "uKitExplore.h"
void setup() {    
    Initialization();
} 

void loop() {    
    setServoAngle(1,30,400);    
    setServoAngle(2,30,400);    
    delay(400);    
    setServoAngle(1,-30,400);    
    setServoAngle(2,-30,400);    
    delay(400);
}

Last updated