Thread: Limit switches
View Single Post
  #7   Spotlight this post!  
Unread 10-02-2003, 09:16
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,563
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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

Does that make sense?