Main Content

writePosition

Write position of servo motor

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

    Description

    writePosition(s,position) writes the specified value to the specified servo on the Raspberry Pi® hardware.

    Examples

    collapse all

    Create servo object.

    mypi = raspi();
    s = servo (mypi, 12);

    Rotate the motor to its mid position.

    writePosition(s, 45)

    Input Arguments

    collapse all

    Connection to servo motor specified as an object.

    Position of servo motor shaft specified as numeric, representing the angle from 0 to 180 degrees.

    Extended Capabilities

    expand all

    Version History

    Introduced in R2016b

    See Also