View Single Post
  #8   Spotlight this post!  
Unread 09-02-2014, 00:42
Adamz_'s Avatar
Adamz_ Adamz_ is offline
Who wants coffee?
AKA: Connor Adams
FRC #4519 (Kings Mechavaliers)
Team Role: Mentor
 
Join Date: May 2013
Rookie Year: 2013
Location: Oakville
Posts: 33
Adamz_ is a splendid one to beholdAdamz_ is a splendid one to beholdAdamz_ is a splendid one to beholdAdamz_ is a splendid one to beholdAdamz_ is a splendid one to beholdAdamz_ is a splendid one to beholdAdamz_ is a splendid one to behold
Re: Waiting Until Limit Switch Is Pressed

i dont know what language your using, but in java it would look something like this

Code:
if(!limitSwitch.get()){
   motor.set(1.0);
 }else if(limitSwitch.get()){
   motor.set(0.0);
}
in englsih all this is doing is saing, if the limit switch if false (not pressed) spin the motor, then in the else if statement, it checks if the limit switch is true (pressed) and if it is, it will stop the motor, if you want it so once its in this state, you press a button to shoot, the code would be this;

Code:
if(!limitSwitch.get()){
   motor.set(1.0);
 }else if(limitSwitch.get()){
   motor.set(0.0);
 }else if(controller.getRawButton(1)){
  motor.set(1.0);
}
__________________
2016 North Bay Regional Finalists
2016 Greater Toronto Central Regional Semi-Finalists
2015 Windsor Essex Great Lakes Regional Quarter-Finalists
2014 Windsor Essex Great Lakes Regional Semi-Finalists
2014 Waterloo Regional Quarter-finalists
2013 Waterloo Regional Highest Rookie Seed
2013 Waterloo Regional Rookie All Star Recipient