Has this ever happened to you? In the middle of a pivotal gateway match, your robot suddenly sputters and dies. No matter how much you desperately mash onthe controls, the only sign of life on your robot is the dim light on the cortex indicating that it has lost connection to the field. Your coach signals frantically to the referee, who is too engrossed in the action of the game to take any notice. All you can do is watch helplessly as the opposing team continues to score unabated.
Well my team was sick and tired of connection errors like these ruining our chances at victory. That’s why we designed a lighting system for our robot that acts as a connection indicator.
The basic idea is that you mount one or more LEDs to your robot in easy to see locations. You then add code that will illuminate the LEDs whenever your robot loses connection to the field. Before a match, you speak with the ref and tell him or her about this lighting system. Then, if you happen to lose connection during a match, the fact that it is a connectivity problem rather than a problem with your robot will be immediately apparent to the referee.
Here is a picture of how we mounted an indicator LED to our robot.
[ATTACH]5443[/ATTACH]
The LED then plugs into one of the digital input/output ports on the cortex.
This is how I got the LEDs working in RobotC:
First, under Robot->Motor and Sensors Setup, register the input port you plugged the LED into as a “Digital Out” port. Then, give it a name (in my program, I called it ‘LED_RED’).
Then, in “pre-auton”, add the following line of code:
SensorValue[LED_RED] = 1;
The reason for this is that the LEDs will turn ON when given a value of 0, and will turn OFF when given a value of 1. By default, the digital output port will return a value of 0. Therefore, you want to send it a 1 in order to turn the LED off before the start of a match.
Then, in the operator control “while” loop, add the following lines of code:
if(bVexNetActive){
SensorValue[LED_RED] = 1;//off
}
else{
SensorValue[LED_RED] = 0;//on
}
‘bVexNetActive’ is a variable that says whether or not the robot is currently connected to the joystick through vexNet. If it is false, then this means that you have a connectivity issue.
And there you have it, your very own connectivity lighting system! Once you have set up the system like this, you can test it the next time you’re driving your robot around by powering off the joystick or unplugging the vexNet from the joystick. If the lighting system activates when you do this, then you will know that it is working properly.
The primary reason for using a lighting system such as this is that it makes it clear to everyone watching the match that there is a problem with the field. While proving to the ref that you’ve been having connection problems will not always change the outcome of your match, it will compel them to take whatever steps necessary to solve said problems, whether that entails replacing hardware or resetting the field. This will help improve everyone’s game experience in later matches
Perhaps some one who is familiar with EasyC can post code for getting the lighting to work in that environment…
Eric Beckmann
Programmer for Team 3129 “The Green MacHHHHine”