public class YServo extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YServo.TimedReportCallback
TimedReportCallback for Servo
|
static interface |
YServo.UpdateCallback
Deprecated UpdateCallback for Servo
|
static class |
YServo.YMove |
Modifier and Type | Field and Description |
---|---|
protected int |
_enabled |
protected int |
_enabledAtPowerOn |
protected YServo.YMove |
_move |
protected int |
_neutral |
protected int |
_position |
protected int |
_positionAtPowerOn |
protected int |
_range |
protected YServo.UpdateCallback |
_valueCallbackServo |
static int |
ENABLED_FALSE
invalid enabled value
|
static int |
ENABLED_INVALID |
static int |
ENABLED_TRUE |
static int |
ENABLEDATPOWERON_FALSE
invalid enabledAtPowerOn value
|
static int |
ENABLEDATPOWERON_INVALID |
static int |
ENABLEDATPOWERON_TRUE |
static YServo.YMove |
MOVE_INVALID |
static int |
NEUTRAL_INVALID
invalid neutral value
|
static int |
POSITION_INVALID
invalid position value
|
static int |
POSITIONATPOWERON_INVALID
invalid positionAtPowerOn value
|
static int |
RANGE_INVALID
invalid range value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YServo(String func) |
protected |
YServo(YAPIContext ctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
static YServo |
FindServo(String func)
Retrieves a servo for a given identifier.
|
static YServo |
FindServoInContext(YAPIContext yctx,
String func)
Retrieves a servo for a given identifier in a YAPI context.
|
static YServo |
FirstServo()
Starts the enumeration of servos currently accessible.
|
static YServo |
FirstServoInContext(YAPIContext yctx)
Starts the enumeration of servos currently accessible.
|
int |
get_enabled()
Returns the state of the servos.
|
int |
get_enabledAtPowerOn()
Returns the servo signal generator state at power up.
|
YServo.YMove |
get_move() |
int |
get_neutral()
Returns the duration in microseconds of a neutral pulse for the servo.
|
int |
get_position()
Returns the current servo position.
|
int |
get_positionAtPowerOn()
Returns the servo position at device power up.
|
int |
get_range()
Returns the current range of use of the servo.
|
int |
getEnabled()
Returns the state of the servos.
|
int |
getEnabledAtPowerOn()
Returns the servo signal generator state at power up.
|
int |
getNeutral()
Returns the duration in microseconds of a neutral pulse for the servo.
|
int |
getPosition()
Returns the current servo position.
|
int |
getPositionAtPowerOn()
Returns the servo position at device power up.
|
int |
getRange()
Returns the current range of use of the servo.
|
int |
move(int target,
int ms_duration)
Performs a smooth move at constant speed toward a given position.
|
YServo |
nextServo()
Continues the enumeration of servos started using yFirstServo().
|
int |
registerValueCallback(YServo.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
set_enabled(int newval)
Stops or starts the servo.
|
int |
set_enabledAtPowerOn(int newval)
Configure the servo signal generator state at power up.
|
int |
set_move(YServo.YMove newval) |
int |
set_neutral(int newval)
Changes the duration of the pulse corresponding to the neutral position of the servo.
|
int |
set_position(int newval)
Changes immediately the servo driving position.
|
int |
set_positionAtPowerOn(int newval)
Configure the servo position at device power up.
|
int |
set_range(int newval)
Changes the range of use of the servo, specified in per cents.
|
int |
setEnabled(int newval)
Stops or starts the servo.
|
int |
setEnabledAtPowerOn(int newval)
Configure the servo signal generator state at power up.
|
int |
setNeutral(int newval)
Changes the duration of the pulse corresponding to the neutral position of the servo.
|
int |
setPosition(int newval)
Changes immediately the servo driving position.
|
int |
setPositionAtPowerOn(int newval)
Configure the servo position at device power up.
|
int |
setRange(int newval)
Changes the range of use of the servo, specified in per cents.
|
_AddToCache, _clearDataStreamCache, _devRequest, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, _uploadEx, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_serialNumber, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, isReadOnly, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int POSITION_INVALID
public static final int ENABLED_FALSE
public static final int ENABLED_TRUE
public static final int ENABLED_INVALID
public static final int RANGE_INVALID
public static final int NEUTRAL_INVALID
public static final int POSITIONATPOWERON_INVALID
public static final int ENABLEDATPOWERON_FALSE
public static final int ENABLEDATPOWERON_TRUE
public static final int ENABLEDATPOWERON_INVALID
public static final YServo.YMove MOVE_INVALID
protected int _position
protected int _enabled
protected int _range
protected int _neutral
protected YServo.YMove _move
protected int _positionAtPowerOn
protected int _enabledAtPowerOn
protected YServo.UpdateCallback _valueCallbackServo
protected YServo(YAPIContext ctx, String func)
func
- : functionidprotected YServo(String func)
func
- : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) throws Exception
_parseAttr
in class YFunction
Exception
public int get_position() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPosition() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_position(int newval) throws YAPI_Exception
newval
- : an integer corresponding to immediately the servo driving positionYAPI_Exception
- on errorpublic int setPosition(int newval) throws YAPI_Exception
newval
- : an integer corresponding to immediately the servo driving positionYAPI_Exception
- on errorpublic int get_enabled() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getEnabled() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_enabled(int newval) throws YAPI_Exception
newval
- : either YServo.ENABLED_FALSE or YServo.ENABLED_TRUEYAPI_Exception
- on errorpublic int setEnabled(int newval) throws YAPI_Exception
newval
- : either Y_ENABLED_FALSE or Y_ENABLED_TRUEYAPI_Exception
- on errorpublic int get_range() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getRange() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_range(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the range of use of the servo, specified in per centsYAPI_Exception
- on errorpublic int setRange(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the range of use of the servo, specified in per centsYAPI_Exception
- on errorpublic int get_neutral() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getNeutral() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_neutral(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the duration of the pulse corresponding to the neutral
position of the servoYAPI_Exception
- on errorpublic int setNeutral(int newval) throws YAPI_Exception
newval
- : an integer corresponding to the duration of the pulse corresponding to the neutral
position of the servoYAPI_Exception
- on errorpublic YServo.YMove get_move() throws YAPI_Exception
YAPI_Exception
public int set_move(YServo.YMove newval) throws YAPI_Exception
YAPI_Exception
public int move(int target, int ms_duration) throws YAPI_Exception
target
- : new position at the end of the movems_duration
- : total duration of the move, in millisecondsYAPI_Exception
- on errorpublic int get_positionAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getPositionAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_positionAtPowerOn(int newval) throws YAPI_Exception
newval
- : an integerYAPI_Exception
- on errorpublic int setPositionAtPowerOn(int newval) throws YAPI_Exception
newval
- : an integerYAPI_Exception
- on errorpublic int get_enabledAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getEnabledAtPowerOn() throws YAPI_Exception
YAPI_Exception
- on errorpublic int set_enabledAtPowerOn(int newval) throws YAPI_Exception
newval
- : either YServo.ENABLEDATPOWERON_FALSE or YServo.ENABLEDATPOWERON_TRUEYAPI_Exception
- on errorpublic int setEnabledAtPowerOn(int newval) throws YAPI_Exception
newval
- : either Y_ENABLEDATPOWERON_FALSE or Y_ENABLEDATPOWERON_TRUEYAPI_Exception
- on errorpublic static YServo FindServo(String func)
func
- : a string that uniquely characterizes the servopublic static YServo FindServoInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the servopublic int registerValueCallback(YServo.UpdateCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback
in class YFunction
public YServo nextServo()
public static YServo FirstServo()
public static YServo FirstServoInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2019. All rights reserved.