Main Content

Standard Servo Write

Set shaft position of standard servo motor to angle specified in degrees

Add-On Required: This feature requires the Simulink Support Package for Raspberry Pi Hardware add-on.

  • Standard Servo Write block

Libraries:
Simulink Support Package for Raspberry Pi Hardware / Basic

Description

Use the Standard Servo Write block to control the shaft angle of a servo motor attached to a pulse width modulation (PWM) output pin on the Raspberry Pi® hardware board.

During simulations without the hardware, this block does nothing. See Block Produces Zeros or Does Nothing in Simulation.

Ports

Input

expand all

The value sent to the block at the input port determines the speed and direction of rotation of the standard rotation servo motor interfaced with the Raspberry Pi hardware board. For example:

  • An input value of 0 positions the shaft at 0 degrees.

  • An input value of 180 positions the shaft at 180 degrees.

  • Any input value between the [0, 180] range, for example 50, positions the shaft at 50 degrees.

  • Any input value out of the [0, 180] range, for example -2 or 188, positions the shaft at 0 and 180, respectively.

Data Types: double

Parameters

expand all

Select your Raspberry Pi hardware board. You can find this information on the target hardware, product packaging, or product documentation.

Select the Raspberry Pi hardware board pin number to which the standard rotation servo write motor input signal is connected. To open the pin map of the Raspberry Pi board, click View pin map.

Note

Do not assign the same pin number to multiple blocks within a model.

Set the minimum pulse duration of the servo signal in seconds.

Set the maximum pulse duration of the servo signal in seconds.

Version History

Introduced in R2016b