Quote:
Originally Posted by Team 4939
If I am using a simple motor for my elevator system, would I need the && statements for speed?
|
I'm not sure what you mean. This does not have "warning track" switches as I described earlier in the thread. I was assuming a simple motor, so probably yes. If you only have one limit switch, you can remove the if statement for the switch you don't have. The reason for the
&& part of the test is that you don't want to set the speed to zero if your speed moves you
away from the limit switch.
Quote:
Originally Posted by Team 4939
If I wanted the elevator to go in the opposite direction for about 1 second based on which switch is pressed, what would that look like?
|
Within the timeout loop, using the same sense of switches and directions as the example, and assuming fulll speed:
Code:
motor.set(TopLimitSwitch.get() ? -1 : BottomLimitSwitch.get() ? 1 : 0);
or in long form:
Code:
if (TopLimitSwitch.get() {
motor.set(-1);
} else if (BottomLimitSwitch.get() {
motor.set(1);
} else {
motor.set(0);
}
Quote:
Originally Posted by Team 4939
And what is 'super(PWM)' represent?
|
This calls the initiator Talon(), but does not create a separate object; it is the beginning of creating this one. Also, super.set() calls the talon set() function.