DocumentsDate added
This program makes the car turn until the touch sensor is pressed. To control the degree and direction of steering, input a number between 100 and -100.
This example demonstrates how a case structure can be used to control the movement of a motor. The state of the case structure is determined by the feedback from a touch sensor. If the touch sensor is pressed the motor moves forward and if is not pressed the motor moves in reverse. Note: The touch sensor is only read once in this program, to have it continually update place the code in a loop.
This example demonstrates how a case structure can be used to control the movement of a motor. The state of the case structure is determined by the feedback from a touch sensor.
This program runs all motors until the touch sensor is pressed, then all motors are stopped using brake.
This program runs both motors forward for five seconds then stops them by braking.
In this program, motors A and B rotate 720 degrees (two revolutions), the NXT brick plays the note C for 1 second, and then motor A rotates 90 degrees.
This program turns the car for a set amount of time. The turning time, steering, power, and ports are all controls rather than constants, which means that they can be adjusted on the front panel of the program.
This program turns the motor on for one second, then stops the motor.
This program uses multiple motors and multiple touch sensors. When it begins motor A runs forward until touch sensor 1 is pressed, motor B then begins to run until touch sensor 2 is pressed.
This example illustrates how to write a proportional, integral controller for the NXT. On the front panel, the user inputs the desired position (in degrees) of the motor. The user can also adjust the control gains, Kp and Ki which affects the input power of the motor. Kp is a proportional gain, it scales the difference between the motor's current position and the desired position--this difference is known as the error. Ki is an integral gain, it scales the total accumulated error during the program. Play around with the gains to see what works the best.