Arduino Toolkit - @servo/servo
- :
obj =
servo(arduinoobj, pin)
- :
obj =
servo(arduinoobj, pin, propertyname, propertyvalue)
Create a servo object using a specified pin on a arduino board.
Inputs
obj - servo object
arduinoobj - connected arduino object
propertyname, propertyvalue - name value pairs for properties to pass to the created servo object.
Current properties are:
- minpulseduration
min PWM pulse value in seconds.
- maxpulseduration
max PWM pulse value in seconds.
Outputs
obj - created servo object.
Example
# create arduino connection ar = arduino(); # create hobby servo (1 - 2 ms pulse range) servo = servo(ar, "d9", "minpulseduration", 1.0e-3, "maxpulseduration", 2e-3); # center the servo writePosition(servo, 0.5);
Properties
The servo object has the following public properties:
- parent
The parent (arduino) for this device
- pins
pins used by this object
- minpulseduration
minpulseduration set for object
- maxpulseduration
maxpulseduration set for object
See also: arduino, readPosition, writePosition.