This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

writePosition

Write position of servo motor

Syntax

writePosition(s,position)

Description

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

Input Arguments

collapse all

Servo object connected to an Raspberry Pi hardware specified as an object.

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

Examples

collapse all

Create servo object.

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

Rotate the motor to its mid position.

writePosition(s, 45)

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

|

Introduced in R2016b