I have a query about the servo library just out of curiosity .
If I would have to write code for servo's from scratch I would propably set the pulses for all motors at the same time in a for loop and turn them off one by one by calculating the time when the next pulse is to fall and load that in the timer's registers. Every time I would write a new position to a motor I would have to recalculate the order of which pulses would fall.
Today I had a conflict with a timer, which led me to downloading the ServoTimer2 library. I was peaking around in the souece but it seems to work differently than I expected. This library can also control 8 servo's opposed to 12. I guess that is related to the fact that an 8 bit timer is used.
From what I get, a pulse is set, a time for the interrupt is loaded for when the pulse ends and then the next pulse is set. So the pulses are not happening on the same moment, correct?
Does the regular Servo library works in the same manner? One of the reasons I thought that the pulses were simultaneously was because that library could handle 12 motors. If all motors would be on 180 degrees all sequential pulses would take 24ms which would result in a frequency of 41,7Hz which is lower than 50Hz.
I do currently not have a oscilloscope or logic analizer to test it.
So could one explain to me briefly how the servo library works?
Kind regards,
Bas