|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Limit Swtich Help
Quote:
Code:
xbox.getRawButton(4) && !limitPressed ![]() Reps from Ether! I am showing my students that one!!! You might have a little bit of a fan club here at Team 2485...we seriously owe a lot to you and it is a shame if I haven't said that and "thank you" before (which is probably the case as I am mainly a lurker...but I am working on it). |
|
#2
|
|||
|
|||
|
Re: Limit Swtich Help
Quote:
if(xbox.getRawAxis(I need to check mapping)) { victor 1.set(1); victor2.set(1); } Last edited by curtis0gj : 05-02-2015 at 06:46. |
|
#3
|
||||
|
||||
|
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;
}
|
|
#4
|
||||
|
||||
|
Re: Limit Swtich Help
Quote:
if (limitPressed = true) will return a boolean: it will always return "true" regardless of the value of limitPressed prior to the test. Last edited by Ether : 04-02-2015 at 19:41. Reason: clarity |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|