Lego Mindstorms comes with three motors. These motors need electricity to run. The Lego Mindstorms provide the electric power to those motors via OUTPUTS. The Lego Mindstorms comes with four OUTPUTS labeled A, B, C, D and are located in the lower section of the lego mindstorms controller brick.
Build a Vehicle to Start the Exercise
Build one of the initial example vehicles from the Lego Mindstorms kit. All we want is for the vehicle to have wheels and for two of those wheels to be driven by two motors. We will start the exercise from that point. The picture below shows two versions of the lego vehicle we will work with.
Making the motors run with NXC
Open a Terminal window and create a new directory called motors in your nxc directory. We will create a new file called move.nxc.
What this program is doing is sending power to the OUTPUT ports A and C at 100% for 3 seconds. NXC provides us with several of these calls that you can refer to in the NXC Language Reference.