Vex Remote Control Vibrate Feature

With the new release of Vex “V5” there have been a mass amount of additions to accessibility, one of which being the vibrate feature on their new V5 remote controls. The vibrate feature in essence, allows teams to make the remote control vibrate to specific patterns to get a message across. The command for this in VCS(Vex Coding Studio) is defined as: “Controller.rumble(” “);”. In the parenthesis you are able to insert things such as a short rumble ("."), a long rumble ("-"), or a pause (" ") similar to the commands of morse code. Experimenting with this, we have created a program in which vibrates the remote controller when the battery reaches a specific percentage. The program is featured below:

#include “robot-config.h”

//Start Main Program.
int main() {
//Reset the variable, “batteryBuzzer” to 0.
int batteryBuzzer = 0;
//Enter a forever while loop
while(true){
//if the variable, “batteryBuzzer” is equal to 0 AND the battery life is between 25 and 16. . .
if((batteryBuzzer == 0) & (Brain.Battery.capacity() < 25) & (Brain.Battery.capacity() > 16)){
//. . . vibrate the controller with long rumbles
Controller1.rumble("- - - -");
//set the variable, “batteryBuzzer” to 1.
batteryBuzzer = 1;
}
//if the variable, “batteryBuzzer” is either equal to 0 or equal to 1 AND the battery life is between 15 and 1. . .
else if(((batteryBuzzer == 0) || (batteryBuzzer == 1)) & (Brain.Battery.capacity() < 15) & (Brain.Battery.capacity() > 1)){
//. . . vibrate the controller with short rumbles
Controller1.rumble(". . . .");
//set the variable, “batteryBuzzer” to 2.
batteryBuzzer = 2;
}
task::sleep(500);
}
}