Library | Building | Programming | Quick Guides Home | Quick Guides to Building | Quick Guides to Programming | LVLM | WeDo
Motors

Order by : Name | Date | Hits [ Ascendant ]
Write a Program 10/26/2009 Hits: 514
This program turns the motor on until the touch sensor is pressed, then displays "Hello, World!" on the NXT screen.

While Loop Motor Control 10/26/2009 Hits: 469
This program runs the motor until the touch sensor is pressed and stops the while loop causing the motor to brake.

Table Car 10/26/2009 Hits: 496

This example enables a NXT car with a light sensor to detect when it has reached the edge of a table, back up, and turn in a random direction, this continues until the program is stopped.

Straight Line Steering 10/26/2009 Hits: 527

You may notice that a NXT car with a steering value of 0 does not drive in a straight line. This problem can be resolved by implementing proportional control, where the motor steering input is a function of the difference between the motor rotation readings.

Straight Line PControl 10/26/2009 Hits: 469
You may notice that a NXT car with independently controlled wheels might not be able drive in a straight line even though the power setting on the motors are the same. Slight differences in the motors and wheels cause them to rotate at different rates. This problem can be resolved by implementing proportional control, where the power setting of the motors is a function of the difference between the motor rotation readings.

motor A power = constant + gain*(encoder A - encoder C)
motor C power = constant - gain*(encoder A - encoder C)

Second Hand 10/26/2009 Hits: 431

This example should approximately represent the second hand of a clock as it goes around.

Run For Time 10/26/2009 Hits: 401
This program turns the motor on for five seconds, at 50 percent power, then stops the motor.

Run For Distance 10/26/2009 Hits: 427
This program turns the motor on, waits for 360 degrees of rotation and then stops the motor.

PI Position Control 10/26/2009 Hits: 590
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.

Multiple Inputs and Outputs 10/26/2009 Hits: 495
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.

«StartPrev12NextEnd»
Page 1 of 2