Hi, I was curious how the Vex Cortex 2.0 could be made to reset or power off through code. We use RobotC.
I was also curious about ways to intentionally crash the Vex Cortex with software. I know that sounds weird but for our in-class robot battles some students have become interested in electronic warfare rather than physical methods.
You cannot power off the Cortex via code, as the physical power switch must be flipped to the ‘off’ position in order to remove power to the Cortex brain. You can, however, set up a function in your code that “locks down” the program, using an infinite while loop:
void stopRobot()
{
//Stop all of your motors first; this will ensure the robot does not enter a runaway condition
//Infinite loop, keeping the robot from doing anything else
while(true);
}
You will need to make sure that your robot’s motors are turned off before calling the function. Please note that entering an infinite loop is a tricky thing (your code will not be able to exit it) so care must be taken.
As far as intentionally causing a crash using a program; I do not recommend attempting to do so as this could cause undesirable robot behavior and potentially damage your robot/sensors/hardware.
Ok thanks, I had seen the bResetFromWatchdog and wasn’t sure if that could work. The student was curious about ways his robot could shut off another robot using software.