Parallax Servo Activation Timer
10 years
I've spent many hours researching this issue with no real luck, so I'm hoping someone can help.

I'm on an aerospance engineering senior design team that is building a remotely operated hot air balloon (45 ft in diameter--Remax sized).  We are using a Parallax servo controller hooked up to a wireless router (using an xbox controller modified to work over USB as a joystick and continuous mode servos) to perform various functions on the balloon, such as controlling a camera gimbal and activating our propane torch.  This last task is giving me a headache.  Essentially we will have two buttons for the torch, one to increase the flame size, one to decrease it.  The problem is that we need to know when the flame is at full burn or when it's at a minimum, so that we don't keep trying to activate the servo and end up stripping gears.

I've written a VBscript that uses the Timer() function to return the amount of time that a button has been pushed, but as soon as you push the button again, it resets.  I need a cumulative time, so that I can report the position of the servo.  Any ideas on how I could do this?  I've tried to use a "do while" loop, but this causes the program to freeze as soon as I push the button.  I've also tried to assign arrays [using the form: Dim MyArray(10)], but I get a "Type Mismatch" error.

I really love this software, it's like a godsend for us.  Any ideas that anyone has on this issue would be like a . . . well, another godsend.

Timed Variables
10 years

Which button are you referring to. Is it a joystick button or a keyboard button? I assume then you are using the Joystick or Keyboard module?

I'm not a 100% sure if this is what you need so perhaps you can include your script to and we can compare notes.

I've included a robo-file below that has a VBScript module in it that will count the number of seconds you hold down the space bar. This version always increments. You would use a similar technique to use another key press to decrease the time from the total set.

This example uses 10 seconds as the upper limit.

Note that the timing will not be very exact since you are not using a realtime system. However, it should be enough to reduce the gear stripping.

Go ahead and run the robo-file. Then edit the VBScript dialog. You will see the variables being created (note the TOTAL_TIME). Click on a non-editable area and press the space bar for a bit. You will notice the TOTAL_TIME increase for the length of time you held the space bar down.

Hope this helps.

Anonymous 10 years
Brilliant!  That's exactly what I needed.  You've made my life so much easier, thank you.  I really wasn't expecting a reply within an hour of posting, much less one that solved my problem completely.  Simply amazing.

One quick question: when you say that it won't be very exact because it isn't realtime, do you mean that it's because the variables only update when the script loops, which requires a finite amount of time?  I noticed that it's really only when I tap the spacebar quickly that it seems to be off by a bit.

Again, thank you for an excellent product.
Loop Timing
10 years
You're welcome!

The timing will be a little off since the loop does take time to execute. For example, if you have a really slow camera then the update loop can be even as long as a second. Thus the servo may be on during that second when it should have been turned off 1/2 way into that second to ensure an exact limit. As long as the loop can execute quite quickly you shouldn't have too much of a problem.


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index