fd9d118fa4
* renaming "setReversed" to "setInverted" to match LabView * fixing samples * typo
1.1 KiB
1.1 KiB
set Reversed
Change the direction of rotation for a motor.
motors.largeA.setInverted(true)
You use a positive value (some number greater than 0
) to drive you motor in the default direction. If you're using a motor in a way that makes more sense for your program to use a negative speed setting for that direction, you can reverse the speed range.
Paramters
- reversed: a boolean value that is
false
if the motor will use a speed value between0
and100
to turn in the default direction. Iftrue
, the motor uses a speed value between0
and-100
to turn in the default direction.
Example
Run the motor connected to port A for 2 seconds at a speed of 30
. Stop and switch the direciton of rotation. Run the motor at a speed of -30
. Watch and see if the motor turns in the same direction as before.
motors.largeA.setSpeed(30)
loops.pause(2000)
motors.largeA.stop()
loops.pause(2000)
motors.largeA.setInverted(true)
motors.largeA.setSpeed(-30)
loops.pause(2000)
motors.largeA.stop()