View Single Post
  #1   Spotlight this post!  
Unread 22-02-2011, 09:41
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
limit switch problem

After 16 hour of working on two limit switches, they still won't work. I wrote a code for our limit switches that when our top limitswitch is pressed it would stop the motor from going up so the motor can only go down, and when the bottom one is pressed it stops the motor from going down so the motor can only go up. The problem is that I does not do any of that. Can any one please review this code an tell me where I went wrong?

Code:
		    if (ds->GetDigitalIn(3) != 1 || ds->GetDigitalIn(3) != 1 && Carriage_down->Get() == 0)
		    {			    
			    Carriage_motor->Set(1.0);
			    while(Carriage_down->Get() == 0)
			    {
			    	Carriage_motor->Set(0.0);
			    }
		    }
		    else if(ds->GetDigitalIn(4) != 1 || ds->GetDigitalIn(4) != 1 && Carriage_up->Get() == 0)
		    {
		    	Carriage_motor->Set(-1.0);
			    while(Carriage_up->Get() == 0)
			    {
			    	Carriage_motor->Set(0.0);
			    }
		    }
		    else
		    {
		      	Carriage_motor->Set(0.0);
		    }

Last edited by krudeboy51 : 22-02-2011 at 09:55.
Reply With Quote