noobtemplate.blogg.se

Robotc language
Robotc language








robotc language

  • Note: to return the current encoder position (and not the target position), use the getMotorEncoder command instead.Ĭode Example: //Reset the encoder count of motor A.
  • This command returns the current encoder target value of the motor plugged into nMotorIndex.
  • 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)

    robotc language

    Target absolute value that the motor will travel to. Void setMotorTarget ( tMotor nMotorIndex, float nPosition, int nspeed ) 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) Halt program flow for 1000ms (1 second)

    Robotc language full#

    A zero value stops the motor.Ĭode Example: //Sets the speed value of motor motor port A to full forward (+100) Values for the motor velocity range from -100 (full reverse) to +100 (full forward).The nMotorIndex command identifies the name or port of the motor.The velocity for the motor, which the nSpeed command is used for, and the port that the motor is plugged into. There are two pieces of information that this command needs.This command will set the speed of the motor.Zero is the value for stopping the motors Port number that the motor is plugged into. Void setMotorSpeed ( tMotor nMotorIndex, int nSpeed ) A count of 180 indicates that the motor has traveled half of a rotation. The encoders have 360 counts per single revolution of the motor. Each motor is equipped with an integrated encoder that can be used to determine the current position of the motor. There are four motor ports on the EV3 labeled A, B, C, and D. Our Function Library (Updated Spring 2013) EV3 - Motor Commands A Non-Functioning EV3 (i.e., frozen or dead).










    Robotc language