Begin by connecting one motor to the port lettered A on your EV3 brick. Attach a short Lego piece to the red axel part, as shown below. This will act as a “compass needle”. Figure 1: Close-up of red axel with pointer attached Open LabVIEW, and start a new VI. Go to the Block Diagram, and open the Mindstorms Robotics submenu in the Function Palette. Finally, open the IO folder. You should see this:
The Move Motors and Stop Motors are the most basic VIs available to move your motors. They actually offer less control than some more advanced VIs available to you. The Advanced Motors contains some motor VIs that are actually a little easier to work with to start. Open this folder. You should see this: The VI here we’ll focus on in Task 1 is Fixed Distance.
An important point to remember from this VI help is that the VI measures distance in “encoder counts”. Each encoder count equals 1 degree. This means if we know the diameter of the wheel attached to the motor, we can figure out linear distance travelled – hence if you fix the encoder counts rotated, you fix the distance traveled. Right now, you simply need to demonstrate that you can turn your pointer around a given angle. We want to rotate 180 degrees from our starting point, wait 5 seconds, then rotate counterclockwise 90 degrees. We will need two motor VIs for this If you read the documentation on this VI, it seems to indicate it incorporates a waiting feature. This may not work! (Welcome to the world of EV3 motor control.) We are going to force the motor to wait by using the Wait For time VI: Start by putting the Wait For icon and two Fixed Distance icons on the Block Diagram, and wire their EV3 ports one to the other with a pink control flow wire like this:
We can now enter 5 second on the Wait For VI. We see from the help that a positive value for distance corresponds to clockwise rotation, negative for counterclockwise. We can then enter a distance of 180 for the first VI, and -90 for the distance on the second VI: VERY IMPORTANT: We don’t really care about how fast the turns are, but
- Fall '07