Competition Language | |
Mod | How to Use |
The modulous function exists in RobotC already. It is a function that, in a mathmatical sense, divides the input by the rate, and then takes outputs the remainder. The effect is a value that increases along with the input until it equals the value of the rate. At that point, it jumps back to zero and starts the sequence again. This command just extends that pattern to negative numbers. Before, the input could not be a negative value.
(input, rate)
The modulous function will return the value of the modulous of input wrapped around rate. So when modulating the value of "x" around five, if it raises above five, it will wrap around to zero. If it drops below zero, it will wrap around to five.