View Single Post
  #2   Spotlight this post!  
Unread 15-02-2015, 15:51
legts legts is offline
Autonomous Queen
FRC #2399 (The Fighting Unicorns)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Ohio
Posts: 73
legts is an unknown quantity at this point
Re: Programming Limit Switches

What you want to do is use code that is sort of like the following:

if(limitSwitch.get() == true){
motorName.stopMotor();
}

This code waits for a limit switch to be pressed. When it is pressed it turns true, triggering the contents of the if statement. The contents call the WPI method stopMotor on the motor. Hopefully this helped.
Reply With Quote