View Single Post
  #6   Spotlight this post!  
Unread 01-02-2007, 09:53
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

Quote:
Originally Posted by SoD View Post
oops I though it should give 1 xD

So if i change it to ==0 it should work?
Usually we give it something to do when it's equal to 1 and something different to do when it's equal to 0.

Relay1 will only change when we explicitly change it. The last thing we did will always be in effect.
For example, in your original code the relay was set to:
Code:
    relay1_fwd = 0; relay1_rev = 0;
in User_Initialization(), then your code changed to to the same value.
Nothing ever changed it to 1.

If you modify your code to use "==0" instead and change it to set the Relay to 1, then Relay1 will begin as 0 and change to 1 when you flip your switch, but nothing will ever change it back to 0 if the switch is flipped off again.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 01-02-2007 at 09:56.