Keyestudio Smart Little Turtle Robot V3 Manual page 88

Table of Contents

Advertisement

www.keyestudio.com
*/
#define servoPin 10 //servo Pin
int pos; //the angle variable of servo
int pulsewidth; //pulse width variable of servo
void setup() {
pinMode(servoPin, OUTPUT); //set the pins of servo to output
procedure(0); //set the angle of servo to 0 degree
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180
degrees
// in steps of 1 degree
procedure(pos);
'pos'
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0
degrees
procedure(pos);
'pos'
// tell servo to go to position in variable
//control the rotation speed of servo
// tell servo to go to position in variable
88

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents