IO

IO Class Reference
IO API Reference

IO is electrical terminal on a device. IO can output ON/OFF or detect a voltage as ON/OFF.

Setting and state

Initial State

On startup, All IO is set to initial state. There is a difference between device types but normally initial state is float (High impedance without pull-up-down ). You can reset IO state by calling io.end().

Using from peripheral

When use a terminal from UART and PWM and other peripherals, io.output() and io.input() functions are stopped.

IO setting will keep. obniz.js provide io setting property for peripheral initialize. So you shouldn't care last io setting before start peirpheral.

// Javascript Example

obniz.uart0.start({
  tx: 0,
  rx: 1,
  baud: 9600,
  drive: "open-drain", // => open-drain
  pull: "5v" // => pull-up to 5v
});

Device Difference

In each device, The number of IOs and IO functions are different. Please refer to device reference.

Articles