I’m just learning about servo controllers and servos so bare with me. I hooked up an RF remote and set the script to have the servo go from frame A to Frame B by pressing the button. Everything works fine, the only problem is I need the servo to power down when it gets to its frames. Right now the servo goes to Frame A and then keeps wanting to move a little more or with a little pressure on the servo, it starts to move and hum. Same thing when it goes to frame B. It’s just a simple open and close action that I need but without the servo constantly humming or moving. thanks for any help!
[code]
goto main_loop # Run the main loop when the script starts (see below).
This subroutine returns 1 if the button is pressed, 0 otherwise.
To convert the input value (0-1023) to a digital value (0 or 1) representing
the state of the button, we make a comparison to an arbitrary threshold (500).
This subroutine puts a logical value of 1 or a 0 on the stack, depending
on whether the button is pressed or not.
sub button
0 get_position 500 less_than
return
This subroutine uses the BUTTON subroutine above to wait for a button press,
including a small delay to eliminate noise or bounces on the input.
sub wait_for_button_press
wait_for_button_open_10ms
wait_for_button_closed_10ms
return
Wait for the button to be NOT pressed for at least 10 ms.
sub wait_for_button_open_10ms
get_ms # put the current time on the stack
begin
# reset the time on the stack if it is pressed
button
if
drop get_ms
else
get_ms over minus 10 greater_than
if drop return endif
endif
repeat
Wait for the button to be pressed for at least 10 ms.
sub wait_for_button_closed_10ms
get_ms
begin
# reset the time on the stack if it is not pressed
button
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat
An example of how to use wait_for_button_press is shown below:
Uses WAIT_FOR_BUTTON_PRESS to allow a user to step through
a sequence of positions on servo 1.
main_loop:
begin
7822 frame
3084 frame
repeat
sub frame
wait_for_button_press
1 servo
return[/code]
You can send a target position of 0 to a servo channel on the Maestro to turn off the signal to that particular servo. However, please note that some digital servos continue holding the most recent position even if the control signal is removed. If this is the case with your servos, you will probably need to set up some way of removing power to the servos. One way you might be able to do this is using MOSFETs to provide power to the servos and triggering them from Maestro channels configured as outputs.
I would like to know whether the the Remote Control type matters on this script, because it doesn’t work for me.
I have a 6 channel Maestro with a Keyes receiver hooked up on the servo controller.
What I want to do is just this:
Pressing a button on the remote control
Servo goes to position A and remain there waiting for a new command
Pressing a button again on the remote control
Servo goes to position B and remain there waiting for a new command
…and so on, between positions A and B. Pretty simple.
I tried other examples from the User’s Guide, to test the communication between the RC and the Micro Maestro, and everything worked fine. I simply don’t understand why this script didn’t.
That script is meant to work with a button that connects directly to the Maestro’s input channel. The six-channel Micro Maestro’s inputs can only be used as analog inputs and cannot be used with hobby RC receivers or IR receivers.
Are you sure about it? I am asking because, as I said in my last post, I tested the communication between the Maestro and the RC, using on of the others more simple scripts found in the manual and it worked.
Each time I push a button on the RC, 3 servos spin once between two positions.
It might be possible that with your setup it is happening to seem to work, but the Maestro is not capable of reading the timing used in RC signals, so it cannot respond to the normal changes in those signals. Could you tell me more about your setup? How do you have things connected? What is the output of your receiver? Can you provide a link to a datasheet or product page for the receiver?
According to your link, your receiver outputs a modulated signal that the Maestro should not be able to read. In addition, in your picture, it looks your receiver is not connected to channel 4 like you have written in your script. I also saw a video on your Photobucket account that shows the servos just moving continuously back and forward, and it looks like they are not responding to any button press.
I am sorry. Although in the image the receiver appears on channel 5, I made the test with it connected to channel 4. As of the video on photobucket, it was an early experiment. Thanks for take your time to help me.
I can upload a video demonstrating what it is happening if you want. However, since that the facts are contradicting the theory, I can’t see how could it be useful.
Anyway, I have an Arduino NANO, and I think that at this point it would be the way to go.
Using an Arduino Nano should be more appropriate for reading your receiver signals. You can still use the Maestro with your Arduino by having the Arduino send commands to the Maestro. We have a Library for Arduino that can help you do this. You can find a link to the Maestro Servo Controller library for Arduino on the Maestro product page.