EasyManua.ls Logo

Keyestudio Ks0428 - Test Result; Code Explanation

Keyestudio Ks0428
247 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
98
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); // tell servo to go to position
in variable 'pos'
delay(15); // waits 15ms for the servo to
reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to
0 degrees
myservo.write(pos); // tell servo to go to position
in variable 'pos'
delay(15); // waits 15ms for the servo to
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

Table of Contents