AUTONOMOUS PROBLEM

I HAVE A PROBLEM, I WROTE THIS CODE FOR AUTONOMOUS:

  	  if ((AutoSwitch3->Get()== 1) && (limitSwitchB->Get()== 1))
  	    {
  		  CamKicker->Set(1.0);
  		  Wait(1.0);
  		  CamKicker->Set(0.0);
  	    } 

when the third switch on the robot is on it sets the cam kicker. before the camKicker is being is set it is pressing limitswitchb.

but its not working, can anyone help please??

no, the logic in his if is right. Double-check that the switches are actually sending data. Nothing that I can see with that code seems wrong

The if statement looks fine to me.

Try outputting the values of AutoSwitch3->Get() and limitSwitchB->Get(). Make sure something odd isn’t going on.

Digital inputs are pulled up (to a logic high… 1). When you short the signal line to ground the input will read as logic low, or 0.

Try doing


if(switch->Get() == 0) {...}

Also make sure your wiring on the switches are correct.

We had a switch wired backwards, so every time it was triggered, it shorted the IO Board, causing all of our stuff to stop.

(And they blamed it on the programming!)

did that! :confused: