Rotate a Servo Motor
This example shows how to rotate a servo motor by its maximum angle.
Create a Raspberry Pi connection.
mypi = raspi();
Configure a servo object using the PWM pin 12 and set the minimum pulse duration to
1e-3 seconds and the maximum pulse durations to
s = servo(mypi, 12, 'MinPulseDuration', 1e-3, 'MaxPulseDuration', 2e-3);
Type the angle of rotation. The maximum angle of rotation is 180.
The angle depends on device pulse duration. Refer to your device data sheet for valid pulse duration values.