View Single Post
  #4   Spotlight this post!  
Unread 01-02-2007, 09:42
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Microswitch problem

The digital inputs are designed to return 1 if the switch is open or disconnected. It returns 0 only when closed.

The code you posted never does anything if the switch is closed (rc_dig_in01 is 0).

Try something like:
Quote:
Originally Posted by SoD View Post
if (rc_dig_in01 == 1)
{
relay1_fwd = 0;
relay1_rev = 0;
}
else
{
relay1_fwd = 1;
relay1_rev = 0;
}
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle