Thread: New Button
View Single Post
  #2   Spotlight this post!  
Unread 15-02-2016, 21:40
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,112
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: New Button

The POV value represents the direction the POV control is being pressed, in compass degrees. It'll be -1 with nothing pressed. I think the Logitech will give values in 45 degree increments.

So what you want to do is wire the POV value to the select terminal of a case structure. If you want "up" to move the motor forward, add a case labeled "0" and put the code to run the motor forward in it. If you want "down" to move the motor backward, add a case labeled "180" and put the code to run the motor backward in it. Add a case named "-1", make it the default, and put code to stop the motor in it.

Instead of doing a Motor Set inside each case, it would probably be better to just put motor speed constants in the cases, wiring them all out of the case block to a single Motor Set function.
Reply With Quote