![robotc ev3 robotc ev3](https://i.ytimg.com/vi/gw4daRmN0b8/maxresdefault.jpg)
into port 2 to -2000 degrees at a speed of -75įloat getMotorTarget ( tMotor nMotorIndex )įunctions returns a floating point decimal value. Sets the absolute position target of the motor plugged into motor port A to 1000 degrees at a speed of 50 The resetMotorEncoder(nMotorIndex) command should be used before a moveMotorTarget(nMotorIndex) to ensure the motor is turning in the correct direction.Ĭode Example: //Sets the absolute position target of the motor plugged.nPosition takes values in degrees (unless the encoder units are set to a different mode using the setMotorEncoderUnits command.The set distance to travel specified by nPosition. The port the motor (in servo mode) is plugged into to nMotorIndex. This command needs three pieces of information. This command tells the robot to move an absolute distance.SetMotorTarget(nMotorIndex, nPosition, nSpeed) Target absolute value that the motor will travel to. Void setMotorTarget ( tMotor nMotorIndex, float nPosition, int nspeed )
![robotc ev3 robotc ev3](https://cdn.slidesharecdn.com/ss_thumbnails/robotics-160503001041-thumbnail-4.jpg)
Moves the motor on motorA -1000 encoder counts (backwards) At the end of this command, the motor will automatically come to a stop.Ĭode Example: //Moves the motor on motor port A 1000 degrees (forward).Setting either the target or the speed to a negative number will cause the motor to rotate backwards.The third item is the velocity, which is designated by the nSpeed command.The amount of degrees (incremental), which is designated by nPosition command.The motor, which is designated by the nMotorIndex command.The command needs three pieces of information: It will add (or subtract) distance from any previously specified targets. This command tells the robot to move a relative distance.MoveMoterTarget(nMotorIndex, nPosition, nSpeed) Speed value that will be passed to the motor (-100 to +100). Target incremental value that the motor will travel to. Void moveMotorTarget ( tMotor nMotorIndex ) Holds program flow until the motor on motor port A comes to a complete stop. You can use this command to avoid providing a wait time.Ĭode Example: //Sets the motorA's target to 1000 encoder counts at a speed value of 50.This command will "sleep" your program until the specified motor (nMotorIndex) comes to a stop.Sets the speed value of motor motor port A to stopped (0)īool waitUntilMotorStop ( tMotor nMotorIndex ) Sets the speed value of motor motor port A to half-speed backwards (-50)
![robotc ev3 robotc ev3](https://i.ytimg.com/vi/PRmy_BCgeKs/maxresdefault.jpg)
Halt program flow for 1000ms (1 second)
![robotc ev3 robotc ev3](https://i.ytimg.com/vi/_2V1xenUFWo/hqdefault.jpg)
Robotc ev3 full#
A zero value stops the motor.Ĭode Example: //Sets the speed value of motor motor port A to full forward (+100)