View Single Post
  #10   Spotlight this post!  
Unread 17-02-2015, 11:42
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Programming Limit Switches

Quote:
Originally Posted by Team 4939 View Post
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 View Post
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 View Post
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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote