Q:

Program a full rotation of a NXT motor in X seconds

I'm interested in mimicking the functionality of the Arqball Spin, at $60 it isn't cheap so I'd like to make the most out of my Mindstorms parts.
I'd like to use NXT-G to program a motor to rotate 360° in 20 seconds. NXT-G can only controll the power of the motor and duration (Unlimited, Degrees, Rotations & Seconds). The power of the motor can be set from 0 to 100 seemingly arbitrary values:

I don't mind using 3rd party software to program the motor, provided it's easy to use.

A:

The problem can be restated:
360 / 20 = 18 deg / sec = 1 deg / .056 sec
One degree is the smallest increment provided by the rotation sensors.
NXT-G has a timer sensor with 1/100th second resolution.
In pseudo-code:
Set a motorPower variable to 10
Start a timer
Loop until rotationDegrees >= 360
    If timeElapsed * 18 > rotationSensorDegrees
        motorPower = motorPower - 1
    Else
        motorPower = motorPower + 1
    End If
    MoveBlock (power = motorPower)
End Loop
MoveBlock (stop)

Of course, use of the 8 tooth and 40 tooth gears to give a 5 to 1 reduction would give even better results.  Even the best programming will have trouble offsetting bad mechanics.

