Quote:
Originally Posted by magical hands
Thank you very much everyone. This post has been really helpful to me. Thanks Mark for sharing your code. The purpose of this LCD is to check the flow of current in our robot, check robot's current angle and distance travelled which is monitored by Gear Tooth Sensor and Gyro. However, the LCD adds the cool factor to the control system. Since its difficult to attach this LCD to the Operator Interface. Now we are planning on attaching a tablet to the OI and have it setup up so the drivers can see all motor values, gyro value, gear tooth value and infact they can precisely control the robot by looking at these values. Also, it helps in troubleshooting our autonomous after every game because we will have record of what went wrong where. So ya!
Is it possible I can change between the two codes in my robot? for example a default code and camera code in robot without downloading back and forth? So I can have control over which code will be used during each game just by flicking some switches on and off?
|
If you have some unused Digital I/O inputs, configure one or more of them to control which 'code' runs.
Code:
unsigned char whichone = 0;
if (rc_dig_in 14) whichone |= 1;
if (rc_dig_in 15) whichone |= 2;
if (rc_dig_in 16) whichone |= 4;
switch (whichone) {
case 0: {
// run this code
}
case 1: {
// or run this code
}
case 2: {
// and so on...
}
default: {
// just in case...
}
} // switch
On the digital inputs just make up some jumpers, or install some switches between the digital input and ground. You might want to avoid using miniture switches that might be jarred during competition.