Digital Input » History » Version 2
Adam Klama, 06/21/2026 03:11 PM
| 1 | 1 | Adam Klama | # Digital Input |
|---|---|---|---|
| 2 | |||
| 3 | ## Overview |
||
| 4 | A **Digital Input** reads an on/off (digital) state on a hardware pin — a switch, |
||
| 5 | button or relay contact. The input is **on** when the pin is **shorted to signal |
||
| 6 | ground (sGND)** and **off** when it is open. On reads as **1024**, off as **0** |
||
| 7 | (use **Invert** to swap them). In its other modes the same pin can instead measure |
||
| 8 | a property of a digital waveform: its duty cycle, frequency, or pulse time. |
||
| 9 | |||
| 10 | Use it for door/neutral switches, mode buttons, and simple signals you only need a |
||
| 11 | single value from. For richer frequency/speed/position work, prefer the |
||
| 12 | 2 | Adam Klama | [Frequency Input](Frequency_Input). |
| 13 | 1 | Adam Klama | |
| 14 | ## Prerequisites & hardware |
||
| 15 | - A contact or signal that **shorts the pin to sGND** to signal "on", and leaves it |
||
| 16 | open for "off". |
||
| 17 | - On = `1024`, off = `0`; use **Invert** if your wiring is the other way round. |
||
| 18 | - Mechanical contacts bounce; plan to use the **debounce** timings below. |
||
| 19 | - For Duty/Frequency/Time modes the signal must be a clean repeating waveform. |
||
| 20 | |||
| 21 | ## Add it in the app |
||
| 22 | 1. Add a new input and choose **Digital Input** as the type. |
||
| 23 | 2. Select the **pin** the signal is wired to. |
||
| 24 | 3. Give it a clear **alias** (e.g. `Neutral Switch`). |
||
| 25 | 4. Choose the **mode** (plain on/off, or duty / frequency / time). |
||
| 26 | 5. Set **Invert** and the **debounce** timings as needed. |
||
| 27 | |||
| 28 | ## Settings reference |
||
| 29 | > Schema: `config/DigitalInConfiguration.proto`. |
||
| 30 | |||
| 31 | | Setting | Meaning | Unit | Range / values | Notes | |
||
| 32 | |---|---|---|---|---| |
||
| 33 | | **Mode** | What the pin reads | — | `Digital In`, `Duty`, `Frequency`, `Time` | `Digital In` = plain on/off. The other modes measure that property of a digital waveform on the same pin. | |
||
| 34 | | **Invert** | Swaps on/off (`1024` ↔ `0`) | — | on / off | By default on = pin shorted to sGND. Invert if the active state is the open one. | |
||
| 35 | | **Enable filter** | Turns on debounce filtering | — | on / off | Recommended for mechanical switches. The three timings below apply when on. | |
||
| 36 | | **Delay** | Debounce delay before a state change is accepted | ms | sint32 | A new level must be stable for this long before it is reported. | |
||
| 37 | | **Hold** | Minimum time a state is held once accepted | ms | sint32 | Stops rapid re-triggering; the state is kept at least this long. | |
||
| 38 | | **Interspace** | Minimum gap between transitions | ms | sint32 | Ignores transitions that arrive closer together than this. | |
||
| 39 | |||
| 40 | **Debounce:** **Delay**, **Hold** and **Interspace** work together to reject |
||
| 41 | contact bounce and electrical noise. Start with small values (a few ms) and |
||
| 42 | increase only if you still see false toggles. |
||
| 43 | |||
| 44 | ## Common settings |
||
| 45 | Digital Input also uses the shared settings — alias and pin. See |
||
| 46 | 2 | Adam Klama | [Common IO Settings](Common_IO_Settings). |
| 47 | 1 | Adam Klama | |
| 48 | ## Example — neutral switch |
||
| 49 | 1. Type **Digital Input**, alias `Neutral Switch`, on the switch's pin. |
||
| 50 | 2. Mode `Digital In`. |
||
| 51 | 3. The switch closes to sGND in neutral, so it reads **on (1024)** in neutral |
||
| 52 | directly — no invert needed (turn **Invert on** only if your wiring is opposite). |
||
| 53 | 4. **Enable filter**, set **Delay** `20`, **Hold** `30`, **Interspace** `10` to |
||
| 54 | reject contact bounce. |
||
| 55 | |||
| 56 | ## Troubleshooting |
||
| 57 | - **State flickers / chatters:** enable the filter and raise **Delay** / |
||
| 58 | **Interspace**. |
||
| 59 | - **Reads the opposite of what you expect:** toggle **Invert**. |
||
| 60 | - **Change is missed or too slow:** **Delay** is too high — lower it. |
||
| 61 | - **Duty/Frequency/Time reads zero:** confirm the mode matches the signal and that |
||
| 62 | the waveform actually toggles cleanly on that pin. |
||
| 63 | |||
| 64 | ## Related |
||
| 65 | 2 | Adam Klama | - [Frequency Input](Frequency_Input) — frequency, speed, duty or pulse time. |
| 66 | - [Analog Switch Input](Analog_Switch_Input) — multi-position switch on one |
||
| 67 | 1 | Adam Klama | analog pin. |
| 68 | 2 | Adam Klama | - [Counter Input](Counter_Input) — count events/edges. |