Competition Language | |||
SetSpeedAccuracy | SensorSpeed | EncoderSpeed | How to Use |
This command tells RobotC how accurate you want your speeds. It defaults to a value of 33. But that value represents how many milliseconds the code waits on that line. The longer it waits, the more you are slowed down, but the more accurate the result is.
All of these three functions return the speed. This one is made for sensors in the analog or digital ports. You type in the sensor port or name and the variable it will save the speed to. It will return the value in rpms.
This command does the same as the previous one. It just works for I2C ports on the backs of the motors. Just type in the motor port or motor name, and it will save its speed to the specified variable. It can also provide about twice the accuracy as before depending on the gear set inside the motor.
All the speed commands are used to save the speed of a sensor to a specified variable. The exeption is the setSpeedAccuracy command. It's value defaults to 33 and a larger value inside it's paranthesis will result in a more accurate reading that takes longer to get. For the other two commands, you include in the parameters one variable first that will be the place where it saves the speed to, and a sensor. The command changes dependent on if you sensor is a digital or analog, or an integrated encoder.