Thread: servo
View Single Post
  #3   Spotlight this post!  
Unread 13-02-2011, 15:17
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: servo

Have a feedback node keep the current value of the servo, which is always writing to it. Have a case structure so that when you press the button, it adds five to the value.

With that setup, it will add 5 degrees every single time the loop runes (which is quite fast). If you want to wait for the button to release and then repress before it adds another five, you will have to add another feedback node. This one would keep the value of another case structure, around the first one. You wire the output of the feedback node into the input of the case structure. This would have several names as the cases: Try calling them "Button Pressed" and "Button Released"

The button released state would look for the button to be pressed, and when that happens would send the +5 degree command and the "Button Pressed" constant to the feedback node. In the Button Pressed state, it would give either a value of "Button Pressed" to the feedback node if the button was pressed or a value of "Button Released" if the button was released. At that point, it would go back to button released and start over.

I guess I'll attach some code.. One of them is how I said to do it in this post, and the "simplified" version is one that uses no case structures and very few functions.
Attached Files
File Type: vi Joystick Servo.vi (10.6 KB, 50 views)
File Type: vi Joystick Servo Simplified.vi (9.6 KB, 30 views)
Reply With Quote