Coordinate Movement Two Motors
In the following program we coordinate motor movements so that they both start and stop at the same time. This program can be modified to make the robot stagger back and forth ankle slowly by adjusting the movement and the speed limit servos.
In this case both motors will move the same amount but in My example will move them different values. I will leave the repairs might like is up to you. We have a full range of motion to move the motor and other measures about half the range. Is relatively easy to change if you want to experiment with it (change the DATA statement). We will read a variable in a DATA statement to introduce a new concept in our learning experiences. DATA statements generally can appear anywhere in a BASIC program. In general case the first thing we should do is figure out which motor has the longest step for other motor make.
All keep time with the motion of the motor. Next let us take an example where a motor moves 254 positions and 127 positions moving one. If we break this step into 254 segments slow the motor should move during each segment. Because we will work with integer, the division will drop the rest and we get a working system. We have the added complication that the 254 as may be necessary to move said second and a half so the delay should add between each step to slow the whole process down. Delay depends on the speed of the computer you are using 9600 baud although communication is the same for all computers, the calculations were made between the transmission and the other implementations vary the speed of the computer you use. You need to run some experiments to determine how to construct a delay you need for a particular computer.
There is one additional complication. Each transmission requires a certain period of time and it should be taken into account when you make your delay calculation. Now let’s see what the bare minimum to move coordination code looks like. The program is moving two legs, one twice as far as the others. Write a program to manipulate all 8 motor with a keyboard so you can see what is considered necessary motor in each joint to move your design goes. It is a utility program that you use to move each motor individually so you can see what the position of the robot when you can design your order runs. It is not possible to make progress by guessing which every joint needs.
This program allows you to move each motor one step at a time from the keyboard at the same time show the number on the screen so you can see where each of the joints really. You have to write a program similar to this one because it is a very useful training keystroke in coordination with the things that happen outside of the computer.