Main Content

writePosition

Write position of servo motor

Description

example

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

Examples

collapse all

Create servo object.

a = arduino('COM4','Uno','Libraries','Servo');
s = servo(a,'D4');

Rotate the motor to its maximum position.

writePosition(s,1)

Input Arguments

collapse all

Servo object connected to an Arduino hardware specified as an object.

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

Version History

Introduced in R2014b