Patent attributes
A swing control method is disclosed. Dual photoelectric sensors and gratings are involved. The method includes: detecting the time when blocked or opening parts of gratings pass through photoelectric sensors; comparing a minimum time value with a time value corresponding to a preset swing amplitude in each swing cycle, and when the minimum time value is not equal to the preset time value, generating a control signal for adjusting an output power of a motor so that the swing amplitude reaches the preset swing amplitude; detecting a current swing direction; and determining whether the current swing direction changes, and if yes, generating a control signal for adjusting the output power of the motor for co-direction supplementary augmentation. The method controls the swing speed of a swing by calculating a value of the time when the blocked or opening parts of the gratings pass through the photoelectric sensors.