Test Result; Code Explanation - Keyestudio Ks0428 Manual

Table of Contents

Advertisement

www.keyestudio.com
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to
180 degrees
// in steps of 1 degree
myservo.write(pos);
in variable 'pos'
delay(15);
reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to
0 degrees
myservo.write(pos);
in variable 'pos'
delay(15);
reach the position
}
}
//****************************************************************

(7) Test Result

Upload code successfully and power on, servo swings in the range
of 0° to 180°. The result is same. We usually control it by library file.

(8) Code Explanation

// tell servo to go to position
// waits 15ms for the servo to
// tell servo to go to position
// waits 15ms for the servo to
98

Advertisement

Table of Contents
loading

Table of Contents