Switch

Switches are handled in obniz.js with obniz.switch. Up to three of them can be connected and used.

Wiring

Wiring must be done in such a way that the switch is pulled down when it is pressed.

Primary Switch

If you have one or more switches, only the first switch will have the following special function.

Trigger Function
Press and hold for a few seconds at startup or immediately after startup Enter setting mode.
Press and hold for more than 10 seconds at startup or immediately after startup. Factory Reset
Press and hold for more than 3 seconds while in setting mode Starts Wi-Fi setting by WPS.
Press while online Sends hardware events to the cloud (e.g. program execution in the cloud).

Cautions.

Press and hold at startup or immediately after startup" depends on the wired IO.

  • Other than GPIO0 => turn on the power while pressing
  • GPIO0 => Press and hold after startup confirmation (LED turns green, etc.)