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).
Summary of Contents for Yocto-Display
Page 1: ...Yocto Display User Manual...
Page 2: ......
Page 40: ...34 www yoctopuce com...
Page 52: ...46 www yoctopuce com...
Page 84: ...78 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 130: ...124 www yoctopuce com...
Page 422: ...416 www yoctopuce com...