

IO Input detect voltage level as boolean applied to a terminal. "Input" but not receiving something. Input is used for detecting button and other components like sensors stats.

## Input by request

[input.Wait()](https://obniz.github.io/obniz/obnizjs/classes/obnizcore.components.peripheralio.html#inputwait) will ask to a device for current voltage state as a boolean. Below is a example for io0.

```javascript
// Javascript Example

var value = await obniz.io0.inputWait();
if (value) {
  // io0 is high level
} else {
  // io0 is low level
}

```

## Input Monitor

Change io to input mode for getting notify when changed. It is useful when state change is not expectable and don't want to miss it.

set a callback function using [input()](https://obniz.github.io/obniz/obnizjs/classes/obnizcore.components.peripheralio.html#input)

```javascript
// Javascript Example

obniz.io0.input(function(value){
  console.log("changed to " + value);
});

```

Frequency is depends on network speed. You may miss some datas when input change is so frequent or fast.

#### Ending input

Same as io.output(). Call [io.end()](https://obniz.github.io/obniz/obnizjs/classes/obnizcore.components.peripheralio.html#end).

```javascript
// Javascript Example

obniz.io0.input(function(value){
  console.log("changed to " + value);
});
obniz.io0.end();

```

## Level for true/false

Voltage level for detecting true/false depends on device.  
obniz Board Series is "CMOS level". See more at device details.
