- 14 Oct 2024
- 2 読む分
- 印刷する
Buttons & Air-Buttons
- 更新日 14 Oct 2024
- 2 読む分
- 印刷する
Air-Buttons
Both Nexmosphere XT-EF30 and XY-240/241 offers “Air-Touch“ functionality. This is exposed as boolean attributes from the template. In addition, XT-EF30 supports gestures which are exposed as an attribute with payload (data) of a string “LEFT/RIGHT/UP/DOWN“.
The XY-240/241 allows detection of a person or object and the distance to it. This is implemented as an attribute-trigger on “range“ (10 levels of 25cm each where <=10cm is “Air-Touch“).
Push buttons
The Nexmosphere XT-B4 is a 4-channel push button interface with LED control. Push buttons are a proven and robust way for users to provide input and navigate through your digital content. Connect up to 4 buttons and programmable options for LED output are: on, off, slow-, and fast-blink. See the file “BtnLED.ts“ for type-defs of the API.
Example:
When a button is pressed:
An attribute with the name defined in the corresponding btnXattributeName is set to active.
If specified, the button's LED is changed to the state defined in the “nexmosphere.BtnLEDs” attribute for the duration specified.
If any btn[n]timeoutMS is specified for this button, the active-state will be toggled back to false after the timeout. The default is 50ms unless it is explicitly set to 0 which never clears active (some other part of the playback-flow is assumed to clear it).
LED-settings
By setting the “data”-value of the “nexmosphere.BtnLEDs“ attribute to a JSON-serialized LEDEffects object, one or multiple button-LED states can be set at once. See nexmosphere/BtnLED.ts for type definitions.
const testLEDstate: LEDEffects = {
"BtnLED1": {
"Mode": LEDMode.slowBlink,
"pressMode": LEDMode.on,
"pressTimeoutMs": 3000,
},
...
Template.json Fields for Button
{
"type": "section",
"caption": "XT-B4N6 Buttons",
"children": [
{
"type": "number",
"key": "xtB4N6_sensorAddress",
"caption": "Sensor address",
"required": false
},
{
"type": "text",
"key": "xtB4N6_btn1attributeName",
"caption": "Button 1 attribute name",
"default": "oneshot.Sensor.Button1",
"required": false
},
{
"type": "text",
"key": "xtB4N6_btn2attributeName",
"caption": "Button 2 attribute name",
"default": "oneshot.Sensor.Button2",
"required": false
},
{
"type": "text",
"key": "xtB4N6_btn3attributeName",
"caption": "Button 3 attribute name",
"default": "oneshot.Sensor.Button3",
"required": false
},
{
"type": "text",
"key": "xtB4N6_btn4attributeName",
"caption": "Button 4 attribute name",
"default": "oneshot.Sensor.Button4",
"required": false
}
]
},
The timeout-values can also be added if needed.
Content.json example
"xtB4N6_sensorAddress": 1,
"xtB4N6_btn1attributeName": "oneshot.Btn1",
"xtB4N6_btn2attributeName": "oneshot.Btn2",
"xtB4N6_btn3attributeName": "oneshot.Btn3",
"xtB4N6_btn4attributeName": "oneshot.Btn4",
"xtB4N6_btn1timeoutMS": 100,
"xtB4N6_btn2timeoutMS": 100,
"xtB4N6_btn3timeoutMS": 100,
"xtB4N6_btn4timeoutMS": 100,
The “Pressed“-state of the LEDs and the “TimoutMS“ are independent of each other.