22. High-level API Reference
324
www.yoctopuce.com
22.5. AnButton function interface
Yoctopuce application programming interface allows you to measure the state of a simple button as
well as to read an analog potentiometer (variable resistance). This can be use for instance with a
continuous rotating knob, a throttle grip or a joystick. The module is capable to calibrate itself on min
and max values, in order to compute a calibrated value that varies proportionally with the potentiometer
position, regardless of its total resistance.
In order to use the functions described here, you should include:
es
in HTML: <script src="../../lib/yocto_anbutton.js"></script>
in node.js: require('yoctolib-es2017/yocto_anbutton.js');
js
<script type='text/javascript' src='yocto_anbutton.js'></script>
cpp
#include "yocto_anbutton.h"
m
#import "yocto_anbutton.h"
pas
uses yocto_anbutton;
vb
yocto_anbutton.vb
cs
yocto_anbutton.cs
java
import com.yoctopuce.YoctoAPI.YAnButton;
uwp
import com.yoctopuce.YoctoAPI.YAnButton;
py
from yocto_anbutton import *
php
require_once('yocto_anbutton.php');
Global functions
yFindAnButton(
func
)
Retrieves an analog input for a given identifier.
yFindAnButtonInContext(
yctx
,
func
)
Retrieves an analog input for a given identifier in a YAPI context.
yFirstAnButton()
Starts the enumeration of analog inputs currently accessible.
yFirstAnButtonInContext(
yctx
)
Starts the enumeration of analog inputs currently accessible.
YAnButton
methods
anbutton
→
clearCache()
Invalidates the cache.
anbutton
→
describe()
Returns a short text that describes unambiguously the instance of the analog input in the form
TYPE(NAME)=SERIAL.FUNCTIONID
.
anbutton
→
get_advertisedValue()
Returns the current value of the analog input (no more than 6 characters).
anbutton
→
get_analogCalibration()
Tells if a calibration process is currently ongoing.
anbutton
→
get_calibratedValue()
Returns the current calibrated input value (between 0 and 1000, included).
anbutton
→
get_calibrationMax()
Returns the maximal value measured during the calibration (between 0 and 4095, included).
anbutton
→
get_calibrationMin()
Returns the minimal value measured during the calibration (between 0 and 4095, included).
Содержание Yocto-Display
Страница 1: ...Yocto Display User Manual...
Страница 2: ......
Страница 40: ...34 www yoctopuce com...
Страница 52: ...46 www yoctopuce com...
Страница 84: ...78 www yoctopuce com...
Страница 92: ...86 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...22 High level API Reference 152 www yoctopuce com On failure throws an exception or returns a negative error code...
Страница 422: ...416 www yoctopuce com...
Страница 424: ...24 Characteristics 418 www yoctopuce com...