In working on the program to test the IR sensors, the code we get is, “This code assumes beacon type selector switch is on digital I/O 7.” Other threads state that a switch must be installed to use this function in competition. What sort of switch do we need? Was it in the KOP? Do we buy it locally? What specs if so?
Unpowered switches are pretty much the same all around - they simply connect the two ends of a circuit together, closing it. I don’t believe switches are in the KOP, but they should be dirt cheap at your local store. Oh, and BTW, could you please not use light blue text on the grey background? Near impossible to read…
Any toggle switch should work, but avoid rocker or momentary switches (pretty much any one that springs back to the a position after you push it). If you are ordering from a catlog like DigiKey you need a toogle switch with a Switch Function: SPST (Single Pull Single Throw) and Switch Circuit: On-Off or Off-On. Avoid any switch with the a Switch Circuit that says “Mom” (Momentary).
You could do as Steve said and make a simple closed circuit by cutting 3 pin cable (AKA PWM cable) and soldering the black wire to the white one. Just plug this cable into digital in 7 when you want to seek beacon type 0 (longer period) and unplug it when you want to seek beacon type 1 (shorter period). I am not sure which beacon FIRST will place on which side.
You could just put a jumper across the pins, no?
As long as you avoid the +5v center pin.
Good call. For some reason I was thinking that the +5v pin was to the outside.
Thanks so much for the info. FWIW, the light blue color is our team color; I’ll not use it again. We were using the center pin, so that is our trouble. Off to the races!
:]
i don;t thisswitch how does it rrecognize wut type beacon it is someone plz explain
The switch returns a value of 0(on) or 1(off)
In the tracker code this switch value is represented by rc_dig_in07
rc_dig_in07 is given another name (DESIRED_BEACON_TYPE) by tracker.h and that’s what you’ll see used in the tracker.c code.
The tracker code then checks rc_dig_in07 to see which of the two beacon types it is supposed to be looking for.
FIRST hasn’t yet told us which sides of the field the two beacons are going to be on, but if you have your beacon switch you can just label them at the regional competition.
I like to think of the switch as red/blue alliance rather than beacon type-0/type-1.
I don’t think they will be either red or blue alliance because there is a beacon on either side of the field. Which means one red alliance will go towards beacon 0 while the other red alliance will drive towards beacon 1. If I am wrong about this please let me know.
So for the switch we just need to jumper the first and third pins for beacon type 1 and leave them off for beacon type 0? I think we tried that and by default it was looking for beacon type 1 with no jumper. I had to hard code in beacon type 0 for it to look for that beacon.
Sorry, we are using a left/right switch as well as a red/blue alliance switch to simplify things for the drivers. That also tells us which direction to strike out at the 10 pt ball, as well as which beacon to home-in on.
[edit]
If the jumper is off the tracker will look for beacon type-1.
With the jumper on it will look for type-0
yes, you’ll need to modify the default beacon code to check rc_dig_in01 for which beacon type it should broadcast.
can you use the switches for other stuff? like if you want to change from IR autono to dead reck autono?, or if you have two dead reckonin codes, be able to switch it before the game?
If you can, can you tell me the variable asigned to the pins?
Thanks.
Yes, that’s one of the main uses of switches.
We have:
- Left/Right switch
- Red/Blue alliance (the combinaton of these two specify the beacon type and which side of the robot the 10 pt ball will be on.)
- a 16-position BCD switch for selecting autonomous modes. It also doubles as a diagnostics switch when in user mode, e.g., center servos.
You can use a multi-position rotary switch from your local Radio Shack by wiring each position to a different available digital input.
Then test it in your code like so:
if (!rc_dig_in01)
{
IR_Tracking();
}
else if (!rc_dig_in02)
{
Dead_Reckon();
}
else
Dead_Reckon(); // Always finish with a default setting