Device - dtex/NodebotUI GitHub Wiki

back

The Input class constructs an object that maps to a single device in Johnny-Five.

Inputs are represented in the HTML by a <fieldset> element that has a unique ID attribute and a data-device-type attribute of one of our Browser Control types. This example:

<form id="sampleBoard" data-device-type="board">
  <fieldset id="myOrientator" data-device-type="orientation">
    <input data-device-type="servo" id="myBeta" data-axis="beta" />
    <input data-device-type="servo" id="myGamma" data-axis="gamma" />
  </fieldset>
</form>

will initialize a board in the NodebotUI server, create an orientation BrwoserControl and bind servos to the beta and gamma axes. When you tilt your device, the servos will move.

Parameters

Attribute Name Type Value(s) Description Required
id String Any string that starts with an alpha or _ A unique identifier. This value must not be used on any other element yes
data-device-type String Orientation Indicates type of BrowserControl yes

API

Lineage

Child of of Window.nodebotui

back

⚠️ **GitHub.com Fallback** ⚠️