Setting duration for servo movement Micro M. 6

Hello,
Just got my micro maestro 6 and played around with it. It’s pretty cool!
Anyways I’m trying to program it to control a continuous servo that would be shutting the blinds.

So my question is how can I create a subframe that I could call up on from the command line and would move the servo in one direction for a set time and then stop.
I have read a few things and could call up frames the way I would like (with MCE remote running Eventghost) but my problem is that I could only come up with scripts that would move the servo to a set position. Not for a set time. I have seen that under sequence there is option for duration which is sort of what I need, but I can not call up on that from the command line in my understanding.

So in my idea it would be like :
sub left
*move servo left for x amount of miliseconds

and then it would just wait till I call up another or the same subframe.

Thanks for all the help

Looks like I solved the problem!
I have overlooked the servo position 0 command, which stops the servo movement.
I haven’t modified my servo yet, that’s the next step, but I believe that a continuous rotation servo would be moving indefinitely unless the signal was stopped, since it would still think it’s in the center position. Am I right?

Thanks

Yes, you are right. Settings the target to 0 on a Maestro will cause it to stop sending pulses to the servo. Most servos (including continuous rotation servos) will stop moving if this happens. If your continuous rotation servo does not turn off when it stops receiving pulses, then you can make it stop by setting the output to be equal to the servo’s neutral position.

–David

Thanks for your reply David! That’s a good idea as well, I’ll try both of the methods once I get some free time.

Thanks again!

hey,

got time to modify my servo.
Both methods work the same :slight_smile:

Now what happens is that whenever I call a subroutine to move servo 1 left or right the red led stays on. buy looking at the error tab it says: “Subroutine call overflow/underflow”.
It still takes commands, so that is good. But is there a way to reset errors from the script or from the command line so I could use the led for something else?
Or even better is there something I could improve on my script to stop this happening?

Here is my script:

80 1 acceleration
80 1 speed

begin
100 delay
repeat

sub right
4000 1 servo
500 delay
6000 1 servo
return

sub left
8000 1 servo
500 delay
6000 1 servo
return

Thanks

Got that sorted as well, found that if I use the quit command instead of return, then it doesn’t cause an underflow.

sorry for posting all this, but there is just way too much to read :slight_smile: as well as didn’t know what to look for exactly.

So I finished my code if anyone is interested :slight_smile:
It has the red led blinking in standby and also has the red led as feedback when the servo is moving.
Now I’ll just have to mount my newly made continuous servo’s shaft to the blind’s shat and there we go, I can adjust my blinds with my pc remote. Useful for adjusting my blinds while watching a movie :slight_smile:
Or opening the blinds automatically in the morning :slight_smile:
I’ll be looking into adding two bump sensors so the circuit would actually know when it has shut completely.
but that will require some more coding and reading :slight_smile:

So here is the code:

begin
mylabel:
led_on
50 delay
led_off
200 delay
led_on
50 delay
led_off
1000 delay
repeat

sub right
led_on
4000 1 servo
500 delay
0 1 servo
led_off
goto mylabel
quit

sub left
led_on
8000 1 servo
500 delay
0 1 servo
led_off
goto mylabel
quit

I’m glad you were able to get things working. Good luck on the project, and let us know how it goes! --David