Page 1 of 1

Servo Macro Automove

Posted: Tue Feb 12, 2013 1:34 pm
by dawladin
Hello flowcode users and adimistators

I got one question how to you know where the servo is when you use the automove macro in flowcode v4

Thanks for reading this post and i hope that you got a solution

Regards Michael

Re: Servo Macro Automove

Posted: Tue Feb 12, 2013 6:00 pm
by dazz
Hi
The component macros remember the 0 position and it counts from there.
I cant post a flowchrt as ive only got V5 and your using V4.
so open a new flowchart, add a servo component, add a servo enable macro( remember the first servo is servo 0 in the macro's) drag a few call component macro's into flowcode and a matching number of delays(set the delays to 2 seconds) set up each call component macro to a number between 0 and 255 (making every other call a zero. run in sim and you will see the servo always goes back to the zero position), See below for an example
one other thing to note is if you put to large a number in it will default to tens for the position, so if you added automove 399 it would move to position 39

automove 0
Delay 2 seconds
automove 134
Delay 2 seconds
automove 0
Delay
automove 244
Delay 2 seconds
automove 0
Delay
automove 76
Delay 2 seconds
automove 0
Delay 2 seconds

Regards
Dazz

Re: Servo Macro Automove

Posted: Tue Feb 12, 2013 6:16 pm
by Benj
Hello,

If you need to monitor the position during an automove command then you can do this by creating a flowcode byte variable called position and then using a C icon to load the current servo position into the position variable.

Code: Select all

FCV_POSITION = MX_SERVO_POSITION[0];
The 0 can be set to 0 - 7 to reference servo 0 to 7.

Re: Servo Macro Automove

Posted: Wed Feb 13, 2013 8:39 am
by dawladin
Thank you very much dazz and benj :)

It worked perfectly so can't say anything else then much appericated guys

Regards Michael