|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#17
|
||||
|
||||
|
Re: Limit Swtich Help
Edit: ninja'd by Jon Stratis. I think that we are saying the same basic things. I'll leave it in case...
Quote:
For example: Code:
boolean b = < something > if( b = true ) A different example: Code:
int x = < something > if( x = 8 ) Code:
int a = < something > int b = a = 9; As for the original question/concern, have you tested that the get() method on the limit switch returns true when the limit switch is pushed? Depending on how you wire it (at least the ones that we have used in the past), you can get either true when the switch is triggered and false when it is not OR you can get false when the switch is triggered and true when it is not. You also never set the limitPressed variable back to false; once set to true, limitPressed seems to remain true until you restart the robot. Finally, if the limit switch is supposed to cancel the action that the joystick's button is performing, then you might want to change: Code:
if (xbox.getRawButton(4)) {
victor1.set(1);
victor2.set(1);
buttonPressedForwardVictor = true;
}
Code:
if (xbox.getRawButton(4) && limitPressed == false) {
Code:
if(limitPressed = true) {
victor1.set(0);
victor2.set(0);
}
else if (xbox.getRawButton(4)) {
victor1.set(1);
victor2.set(1);
buttonPressedForwardVictor = true;
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|