View Single Post
  #8   Spotlight this post!  
Unread 10-02-2015, 16:09
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Micro Switch Wiring & Programming

In a procedural language like C++ or Java, the programming for a limit switch is simple. Just before you call the motor.Set() method, test to see whether the value to send to the motor is forward while the forward limit switch is active, and set the value to zero if so. If you also have a reverse limit switch, add another test to see whether the motor value is reverse while the reverse switch is active, and zero the value if so. Only then do you actually set the motor to that value.