nxtlib/src/Protocol.cs
/// <summary>
/// <para>[Internal] Run motors on the NXT brick.</para>
/// </summary>
/// <param name="motorPort">MotorPort Port</param>
/// <param name="power">Power Set Point, between -100 and 100.</param>
/// <param name="mode">Mode</param>
/// <param name="regulationMode">Regulation Mode</param>
/// <param name="turnRatio">Turn Ratio, between -100 and 100.</param>
/// <param name="runState">Run State</param>
/// <param name="tachoLimit">Tacho Limit, 0=run forever</param>
/// <returns>Returns true if operation was a success, false otherwise.  If false, check LastError.</returns>
[Internal] Run motors on the NXT brick.
[ Internal ] Run motors on the NXT brick .
internal void SetOutputState(Motor motorPort
                , sbyte power, MotorMode mode
                , MotorReg regulationMode, sbyte turnRatio
                , MotorState runState, UInt32 tachoLimit)
            {
                if (power < -100) power = -100;
                if (power > 100) power = 100;
                if (turnRatio < -100) turnRatio = -100;
                if (turnRatio > 100) turnRatio = 100;
                byte[] request = new byte[12];
                request[0] = (byte)(0x00);
                request[1] = (byte)(DirectCommand.SetOutputState);
                request[2] = (byte)motorPort;
                request[3] = (byte)power;
                request[4] = (byte)mode;
                request[5] = (byte)regulationMode;
                request[6] = (byte)turnRatio;
                request[7] = (byte)runState;
                SetUInt32(tachoLimit, request, 8);
                CompleteRequest(request);
            }
internal void SetOutputState ( Motor motorPort , sbyte power , MotorMode mode , MotorReg regulationMode , sbyte turnRatio , MotorState runState , UInt32 tachoLimit ) { if ( power < - 100 ) power = - 100 ; if ( power > 100 ) power = 100 ; if ( turnRatio < - 100 ) turnRatio = - 100 ; if ( turnRatio > 100 ) turnRatio = 100 ; byte [ ] request = new byte [ 12 ] ; request [ 0 ] = ( byte ) ( 0x00 ) ; request [ 1 ] = ( byte ) ( DirectCommand . SetOutputState ) ; request [ 2 ] = ( byte ) motorPort ; request [ 3 ] = ( byte ) power ; request [ 4 ] = ( byte ) mode ; request [ 5 ] = ( byte ) regulationMode ; request [ 6 ] = ( byte ) turnRatio ; request [ 7 ] = ( byte ) runState ; SetUInt32 ( tachoLimit , request , 8 ) ; CompleteRequest ( request ) ; }
[Internal] Run motors on the NXT brick.
[ Internal ] Run motors on the NXT brick .
Returns true if operation was a success, false otherwise.  If false, check LastError.
Returns true if operation was a success false otherwise . If false check LastError .
motorPort
Motor
None
power
sbyte
Power Set Point, between -100 and 100.
Power Set Point between - 100 and 100 .
mode
MotorMode
None
regulationMode
MotorReg
None
turnRatio
sbyte
Turn Ratio, between -100 and 100.
Turn Ratio between - 100 and 100 .
runState
MotorState
None
tachoLimit
UInt32
Tacho Limit, 0=run forever
Tacho Limit 0 = run forever