Contenido principal

writePosition

Write position of servo motor

Description

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

Note

To generate C/C++ code for this function, you must have an Embedded Coder® license.

example

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