Sounds cool. There's a good externals-howto available at:
Arf, it's the one I learned the PD API with... I think I should have pushed my reading a little deeper than the examples :) Reading references is always good...
[pack] likes to output the selector "list", so if you want to feed [pack]'s output to your object, you need to do something like:
class_addlist(servo_class, servo_list);
in servo_setup() and write a method:
void servo_list(t_servo *x, t_symbol *sel, int argc, t_atom *argv);
... where you can just do some type-checking and call "servo_go()"
It works great! Now I can go to sleep!
I've never tried it, but you might be able to do:
class_addmethod(servo_class, (t_method)servo_go, &s_list, A_DEFFLOAT, A_DEFFLOAT, 0);
in servo_setup(), and pass the object pairs of floats:
[42\ [24\ | | [pack 0 0] | [servo ...]
... providing that every [pack]ed message is interpreted as a "go" message...
I tried this before I knew about class_addlist. It doesn't work. Also tried getsym("list") which, I believe, is the same as &s_list.
Your other very easy solution works, of course. How could I have missed it? Ho! I'm tired too :)
Well, if someone is interested in this little device, I can put up a web page decribing it.
Thanks to all and especialy Bryan, Julien
Hi, Julien Jassaud hat gesagt: // Julien Jassaud wrote:
Well, if someone is interested in this little device, I can put up a web page decribing it.
It sounds interesting, my question is: Could this be made two-way? So that you could build a kind of motor-fader that can control and be controlled by Pd?
ciao