If a device has a switch, you can read or monitor it. For obniz Board series, it's on left-top.
Register a function to switch.onchange. The function will receive all switch state changes.
Switch monitoring can't be disabled like io.input().