User Manual
41
Code Explanation
6.1 ServoWrite.ino
Looking at the code folders, you may find that on matter for the app, the obstacle
avoidance function or the line following, there is always a sketch ServoWrite.ino. Actually it's
for servo control, so no wonder. You can check the description below for the code.
Control the servo on pin 2
The program above is for control of a single servo. By setting three parameters including c2,
the starting angle, s2, the end angle, and ms0, the rotation speed, we can control the
rotating angle and speed of the servo.
Control the servos on pin 4 and pin 7
The program below is for controlling two servos simultaneously. By setting five parameters
including the starting angles c4 and c7, the end angles s4 and s7, and the rotation speed
ms0, we can control the rotating angle and speed of two servos at the same time.
SunFounder