|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Jiggly servo
We have a two speed transmission that shifts with a servo. We want to press the trigger button to shift between high and low gear. We want the program to Get the Servo angle...decide if it is in high gear (45) or low gear (120)...then shift into the opposing gear.
The problem with the program- program attached below- is... when we pull the trigger button the servo JIGGLES before it decides what gear it sets in. Most of the time it chooses the correct gear but not always. Are we taking the wrong approach? |
|
#2
|
|||
|
|||
|
Re: Jiggly servo
You want to trigger the change when the button is pressed, but right now you are triggering the change whenever the button is down. This results in it flickering between the two states as fast as the program cycles, and will 'randomly' pick one when you let go.
Try to figure out how you can only trigger when the button wasn't pressed but now is - only once per button push. You are really close, I'm sure you'll get it quickly. As a hint, the "shift register" will remember something one time tick in the past. |
|
#3
|
|||||
|
|||||
|
Re: Jiggly servo
It is probably best to think about the problem Eric highlighted for a bit and see if you can solve it yourselves (you'll learn more), but if you get stuck you may find this thread of interest:
http://www.chiefdelphi.com/forums/sh...light=one+shot |
|
#4
|
|||||
|
|||||
|
Re: Jiggly servo
I think you are. Using a "toggle" function to shift between high and low gear isn't the sort of thing I'd want to use if I were driving. I would want one control to select high gear, and another control to select low gear.
However, if you really do want to make it work that way, Eric and Kevin have good advice. The thread Kevin linked to can show you a simple fix for your code if you understand what's going on. |
|
#5
|
|||
|
|||
|
Re: Jiggly servo
Alan, I agree. We did have two buttons setup for the drivers, but they asked for a single button shift.
I really did not understand the threads. We don't have any trained talent on the programming team. We don't offer a class at our high school and we don't have any outside mentoring to help us learn. Everything we know we have learned through LVMastery and ChiefDelphi. We will try Alan's "rising edge" program. We don't understand the logic in it, but I have seen the icons before. |
|
#6
|
|||||
|
|||||
|
Re: Jiggly servo
Quote:
So the code outputs true if and only if the button is pressed now and wasn't pressed the last time the code executed. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| servo on DS | eitang | FRC Control System | 1 | 16-01-2009 14:32 |
| Servo Strength | TJ4nier | Motors | 20 | 13-02-2007 02:59 |
| Servo behavior question / advanced servo/PIC programming question | DanL | Electrical | 12 | 18-10-2005 18:33 |
| Buying Servo | Gamer930 | Motors | 4 | 13-02-2005 20:44 |
| Servo | MASherry | General Forum | 6 | 04-10-2004 22:46 |