There should be a page in the robot controller manual that tells you what pins are used for what on the digital input port. On the same page it will tell you what variable each input pin is set as in the default program. Then in the program you use that variable, which will either be 0 or 1.

I don't know... i hooked up 2 limit switches and wired them into rc_sw5 and rc_sw6, so it would stop the forward and back (actually will be up and down) motion when it tipped the switch. they were wired to the right pins, i made sure using a multimeter, yet when i ran pwm3, flipping the switches no more stopped the movement than if they weren't there in the first place. i'm kindof a n00b, so i'm probably making a stupid mistake. any suggestions from anyone??

Originally posted by Mythikal I don't know... i hooked up 2 limit switches and wired them into rc_sw5 and rc_sw6, so it would stop the forward and back (actually will be up and down) motion when it tipped the switch. they were wired to the right pins, i made sure using a multimeter, yet when i ran pwm3, flipping the switches no more stopped the movement than if they weren't there in the first place. i'm kindof a n00b, so i'm probably making a stupid mistake. any suggestions from anyone??

What evidence do you have that your switches are connected correctly? The only evidence I've heard says they aren't correct.
You should have two wires going from each switch to the digital input port on the RC. For this application you will want to have one of the wires connected to the "normally open" (NO) terminal of the switch, and the other wire to the common (COM) terminal. According to the table on page 10 of the Full-Size Robot Controller Reference Guide, switch 5's NO should be wired to pin 4 of the digital input port, and switch 6's to pin 5. The COM terminals of each switch must be connected to a ground pin (3, 6, 9, 12, 13, 14, 17, 20 or 23) on the input port.

if you want to verify that the switches are working, use a debug statement in your code. Something to the effect of:

debug "rc_swA ", BIN rc_swA, " rc_swB ", BIN rc_swB, CR

then you can see whether the 5th and 6th bit positions of rc_swA change when you press the switch. If different bits change, then you hooked up the common correctly, but not the switch input. If no bits change, then you either have a dead switch (you can check with a multimeter) or you wired to either two grounds or two switch inputs.

If everything works correctly, then the problem is with your code, and you would have post it.

Assuming that you are still using the default code, you actually need to use the "Normally Closed" terminal.

Code:

if rc_sw5 = 0 then next1:
p3_y = p3_y MAX 127
next1:

When a switch is closed, it reads a 1. so, to stop the motor, you need it to read a 0, which means pressing the limit switch when it is normally closed. If you want to use the normally open terminal, you would need to modify the default code and change the if rc_sw5 = 0 to if rc_sw5 = 1

The best evidence that the connections are correct is a statement in your program

DEBUG cls, bin8 rc_swA,cr

When you run the program, activating a switch should change the appropriate 0 to a 1.

Even if you are not a complete noobie, one source of frustration is the DB-25, with its invisible numbers beside each pin. The end with pin 1 is on the right with the longer row of 13 pins up, looking at the solder cups - I just rewired two connectors I'd connected in error

If you are wiring micro switches, the common connection is on the bottom, and the side (one of the two smallest faces) has NC and NO connections.

If you are wiring photosensors, make sure you connect the BrowN wire to +12V not the +5V available in the connector, and the BlUe wire to ground.

Alright.... what i'm doing is having the motor stop when it hits the limit switch... when it hits the switch, it completes the connection, and it sends a "1" signal to the RC Controller.... correct? anyways.. i'm still messing with it. i'll look at the numbers on the pins to be sure, and i'll print this all off to try it and get back to you later on... thanks for the help
~Mythikal, Team 1104