Basic Outputs
Icon & Quick HintsExamples

Begin Hints: Always start an Inventor program with this command. This command will work with all hardware (NXT, RCX, Control Lab).
This piece of code would turn on motor A for one second and then turn it off.

End
Hints: Always end an Inventor program with this command.  Each task will need its own end command. This command will work with all hardware (NXT, RCX, Control Lab).
This piece of code would turn on motor A for one second and then turn it off.

Motor A forward
Hints: Use this if you have a motor connected to port A that will be spinning in the forward direction.  If you want the motor to spin the other way, use the Motor A Reverse command. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast).
This piece of code would turn on motor A in the forward direction for one second and then turn it off.

Motor A reverse
Hints:  Use this if you have a motor connected to port A that will be spinning in the reverse direction.  If you want the motor to spin the other way, use the Motor A Forward command. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast).
This piece of code would turn on motor A in the reverse direction for two seconds and then turn it off.

Lamp A
Hints: Use this if you want the lamp connected to port A to turn on. Use the power level modifier to change it from bright (5) to dim (1). Without a modifier, the power level will be 5 (bright).
This piece of code would turn on the lamp connected to port A for one second and then turn it off.

Stop A
Hints: Use this to stop the motor or lamp connected to port A by braking (abrupt stop). To get a more gradual stop, use the float command.
This piece of code would turn on the lamp connected to port A for one second and then turn it off.

Stop all Outputs
Hints:  Use this to stop the motors and / or lamps connected to all ports by braking (abrupt stop). To get a more gradual stop, use the float command.
This piece of code would turn on lamps connected to ports A, B, and C for one second, and then turn them all off.

Play Sound
Hints: Use this command to get an audio response from the RCX.  Change sounds using the sound type drop down menu or a numeric constant modifier. This modifier must be an integer from 1 to 16. Each represents a pre-programmed sound. 1: Key-click, 2: Beep Beep, 3: Descending Sweep, 4: Rising Sweep, 5: Buzz, 6: Fast Rising Sweep, 7: Short Click, 8: Exception (error). Numbers 9-16 play the same sounds, but without the wait - i.e. the program continues while the sound is being played.
This piece of code would play a fast rising sweep sound (the default).

Flip Direction
Hints: Use this command if to flip the directions of the motors once they are on. Use the ports modifier to flip specific ports. Without a modifier, this command will flip the direction of all ports. This does NOT turn the motor on. It needs to be used in combination with a command that starts the motor or at a point in your program where the motor is already on. 
This piece of code would turn on motor A in the forward direction, wait one second, flip the direction of motor A (to reverse), wait one second, and then turn motor A off.

Float outputs
Hints: Use this command if you want motors to come to a more gradual stop. This command will simply stop powering the motors. Use the ports modifier to float specific ports. Without a modifier, this command will float all ports.
This piece of code would turn on motor A in the forward direction for one second, then it would float the motor.
Motor B forward Hints: Use this if you have a motor connected to port B that will be spinning in the forward direction. If you want the motor to spin the other way, use the motor B reverse command. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast). This piece of code would turn on motor B in the forward direction for four seconds and then turn it off.

Motor C forward
Hints: Use this if you have a motor connected to port C that will be spinning in the forward direction.  If you want the motor to spin the other way, use the Motor C reverse command. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast).
This piece of code would turn on motor C in the forward direction at power level four for six seconds and then turn it off.
Motor B reverse
Hints: Use this if you have a motor connected to port B that will be spinning in the reverse direction.  If you want the motor to spin the other way, use the Motor B forward command. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast).
This piece of code would turn on motor B in the reverse direction for eight seconds and then turn it off.
Motor C reverse
Hints: Use this if you have a motor connected to port C that will be spinning in the reverse direction.  If you want the motor to spin the other way, use the Motor C forward command. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast).
This piece of code would turn on motor C in the reverse direction for ten seconds and then turn it off.
Lamp B
Hints: Use this if you want the lamp connected to port B to turn on. Use the power level modifier to change it from bright (5) to dim (1). Without a modifier, the power level will be 5 (bright).
This piece of code would turn on the lamp connected to port B for one second and then turn it off.


Lamp C
Hints: Use this if you want the lamp connected to port C to turn on. Use the power level modifier to change it from bright (5) to dim (1). Without a modifier, the power level will be 5 (bright).
This piece of code would turn on the lamp connected to port C for one second and then turn it off.

Stop B
Hints: Use this to stop the motor or lamp connected to port B by braking (abrupt stop). To get a more gradual stop, use the float command.
This piece of code would turn on the lamp connected to port B for one second and then turn it off.

Stop C
Hints: Use this to stop the motor or lamp connected to port C by braking (abrupt stop). To get a more gradual stop, use the float command.


This piece of code would turn on the lamp connected to port C for one second and then turn it off.

Lamp
Hints:  Use this command to turn on lamps. The ports modifier allows you to choose which lamps you want to turn on.  If no modifier is used, this command will turn on all ports.  Use the power level command to change from 5 (bright) to 1 (dim).  Without a modifier, the power level will be 5.

This piece of code would turn on lamps connected to ports A and C at power level 3. After 6 seconds, it would turn them off. 

Stop Outputs
Hints:  Use this to stop motors or turn off lamps. This command abruptly stops motors by braking. To get a more gradual stop, use the float command.  Use modifiers to choose which ports to stop.  Without a modifier, this command stops all ports.
This piece of code would turn on motors A and B in the forward direction for two seconds and then stop both motors.

Motor forward
Hints:  Use this to turn on the motor(s) in the forward direction. Use the ports modifier to choose which motors to turn on. Without a modifier, this command will turn on all ports. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast). 
This piece of code would turn on motors connected to ports A and B in the forward direction. After 4 seconds, it would turn them off.

Motor reverse
Hints: Use this to turn on the motor(s) in the reverse direction. Use the ports modifier to choose which motors to turn on. Without a modifier, this command will turn on all ports. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast). 
This piece of code would turn on motors connected to ports A and B in the reverse direction.  After 4 seconds, it would turn them off.
Motor Random
Hints: Use this icon when you want the motor to turn on in a random direction. This icon DOES turn the motor on.  The default is to turn on all ports to power level 5.
This piece of code turns motor A on in a random direction. The motor runs for 10 seconds, and then stops.
Change Motor Speed Hints: Use this icon when you want to change or assign motor speeds. This does NOT turn the motor on. It needs to be used in combination with a command that starts the motor or at a point in your program where the motor is already on. 
This piece of code turns on motor A in the forward direction at full power for one second, then it changes to power level 3 for ten seconds and turns off.
Reverse
Hints: This command just sets the direction to reverse. It does NOT turn the motor on. It needs to be used in combination with a command that starts the motor or at a point in your program where the motor is already on. If the motor is already going in the reverse direction, there will be no change.
This piece of code assigns the speed of motor B to 3, and the direction of motor B to reverse, and then turns it on. After 2 seconds it turns the motor off.
Forward
Hints:  This command just sets the direction to forward. It does NOT turn the motor on. It needs to be used in combination with a command that starts the motor or at a point in your program where the motor is already on. If the motor is already going in the forward direction, there will be no change. 
This piece of code assigns the speed of motor B to 3, and the direction of motor B to forward, and then turns it on. After 2 seconds it turns motor B off.
Random Direction
Hints: Use this icon when you want the direction of the motor to be randomly selected. This does NOT turn the motor on. It needs to be used in combination with a command that starts the motor or at a point in your program where the motor is already on.

This piece of code turns motor A on in the forward direction and then randomly selects a direction for the motor (forward or backward), the motor runs for 10 seconds and is then stopped.

Turn Outputs On
Hints: Use this command to turn on motors and lamps with their last power and direction settings. 


This piece of code assigns the speed of motor B to 3, and the direction of motor B to forward, and then turns it on. After 2 seconds it turns motor B off.


Motor Forward or Back
Hints: Use this command when you want the speed and direction of the motor related to positive and negative numbers. 


This piece of code puts the value -5 in the red container. It then loops 11 times running the motor at the speed in the red container for 1 second , beeping and then augmenting the value of the container by 1. Hence, the motor runs backwards from speeds 5 - 1, stops while the power is equal to 0, and the runs forward from speeds 1-5.


Motor Power
Hints: This command will turn on motors at a specified power level. Indicate the motors by using the port A, B, or C icons. To specify a power level, string in a numeric constant. 1to 100 are forward, 0 is stopped (no power), and -1 to -100 are backward.


Motors A and C will turn on in the forward direction at speed 50. After 4 seconds, the motors will be turned off.


Motor Forward or Back String
Hints: This command will turn on motors at a power level specified by a string. Indicate the motors by using the port A, B, or C icons (or encoder A, B, or C in the NXT commands menu). To specify a power level, right-click (control-click for Mac users) on the lower right corner and choose Create Constant. This will allow you to type in the name of a string variable to use to control motor speed.


In this example, an NXT motor is trying to remain in the same position. The value of the encoder on NXT motor A is placed in a string container called rotation. The value speed is calculated using the Evaluate Expression command. Then, the variable speed is used as the power level for Motor A. This process repeats indefinitely as it is inside jump commands. Depending on the desired sensitivity and direction the motor is connected, the values in the speed expression may need to be modified.