45
In the program above, the number 30, the value in the function
ServoWrite()
represents the
pace of RollFlash. Due to its structure design (the servo installation), the moving pace is fixed.
How can it move forward? It moves its feet diagonally in opposite directions:
raise the right
front foot and move forward
->
raise the left front foot and right hind foot at the same time
to move the body
–>
the right front foot gets on the ground
–>
raise the left hind foot to
move forward
–>
the left hind foot gets on the ground
. It walks a step forward after all these
actions.
Then it continues from the other side:
raise the left front foot and move forward
–>
raise the
right front foot and left hind foot at the same time to move the body
–>
the left front foot
gets on the ground
–>
raise the right hind foot to move forward
–>
the right hind foot gets
on the ground
. It walks another step forward then.
Therefore, it will keep walking forward by continuing these two loops.
The program above is to control it move backward, which is similar to moving forward. The
only difference is the walking direction:
raise the right hind foot and move backward
->
raise
the right front foot and left hind foot at the same time to move the body
->
the right hind
SunFounder
Содержание RollFlash
Страница 44: ...42 Control the servos on pin 5 pin 6 and pin 8 S u n F o u n d e r ...
Страница 52: ...50 S u n F o u n d e r ...