Martin Peach wrote:
Christian Klippel wrote:
hello,
servo's are _slightly_ different in that they dont take the classical pwm that you can regulate from 0..100%.
instead, a servo needs a repetetive pulse between 1 and 2 miliseconds. that pulse train can have a frequency from 30 to 400 hz, for example, but the pulse width stays in the same range. a pulse of 1.5 ms positions the servo into the center, 1 and 2 ms are for the full movement to the left or right respectively.
in the controller you need a loop (or, preferably, an interrupt) that just waits some 20 ms, then sets the pulse on, waits 1 to 2 ms, and turns off again, then repeat ....
...or a 50Hz pwm with a positive pulse width varying between 5 and 10 percent. Doing this from a soundcard output is bad because 50Hz is close to the low-frequency cutoff of the card, so the parts of the pulse that should be at either 0V or 5V will actually drift towards each other. You would need to add a comparator to get a digital level signal. The arduino digitalWrite command in conjunction with delayMicroseconds (for the positive pulse)and delay (for the negative pulse) should be OK for this.
Oh yes, and the arduino analogWrite (pwm) will not work because it splits the pwm signal into many small pulses so that it works better for audio.
Martin
Martin
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list