We would like to build a battery life tester using a Cortex as the controler. Is there a way for RobotC to read the voltage of the Cortex battery and then compare that value to a reference value using an IF statement?
Yes, there are a couple of ways to to this. You can either use the nAvgBatteryLevel or the nImmediateBatteryLevel commands to read the value of the VEX battery. Both are of integer types (and in millivolts, so a value of 7500 refers to 7.5 volts) and can be assigned to variables or used as conditions in IF statements.
More information on these two battery commands, as well as the backup battery commands, can be found here: http://www.robotc.net/wiki/VEX2_Battery_and_Power_Control