Digital Input
Applies to: IOcan · Standalone controller. IOcan has no dedicated digital input pins — configure one of its analog inputs in digital mode instead. What this means
Overview
A Digital Input reads an on/off state on a hardware pin — a switch, a
button, a relay contact. The input is on when the pin is shorted to signal
ground (sGND) and off when it is open. On reads as 1024, off as 0; use
Invert if your wiring is the other way round.
The same pin can instead measure a property of a digital waveform — its duty cycle, its frequency, or its pulse time — by changing the mode. For anything involving a trigger wheel, missing teeth or direction, use a Frequency Input instead; this input's non-digital modes are the simple cases.
Paddles, mode buttons, neutral and brake switches all reach the device as contacts. Wiring concepts covers the shifter side; the IOcan pinout and the standalone controller pinout say which pins are available.
Prerequisites & hardware
- A contact that shorts the pin to sGND for "on" and leaves it open for "off".
- For the Duty, Frequency and Time modes, a clean repeating waveform on the pin.
- Mechanical contacts bounce. Read the note on the filter below before assuming that is what the filter is for.
Add it in the app
- Add a new input and choose Digital Input as the type.
- Select the pin.
- Give it a clear name (e.g.
Neutral Switch). - Choose the mode.
- Set Invert to match your wiring.
- Leave the filter off unless this is a momentary button.
Settings reference
| Setting | Meaning | Unit | Range / values | Notes |
|---|---|---|---|---|
| Mode | What the pin reads | — | Digital In, Duty, Frequency, Time |
Digital In is plain on/off. The others measure that property of a waveform on the same pin. |
| Invert | Swaps on and off | — | on / off | Combined with the pin's own hardware polarity, so the result is the exclusive-or of the two. |
| Enable filter | Converts the input into a one-shot event | — | on / off | Not a debouncer — see below. |
| Delay | Cycles the pin must hold high before the event fires | cycles (≈ ms) | sint32 | Filter only. |
| Hold | — | — | — | Inert. The value is accepted and then overridden by the firmware with a fixed one-cycle event. |
| Interspace | Cycles before another event may fire | cycles (≈ ms) | sint32 | Filter only. |
The filter is for buttons, not for switches
⚠️ Turning the filter on stops this input reporting a state. After the pin has been high for Delay cycles the input reads
1024for exactly one cycle, then reads0again for as long as the contact stays closed. Nothing can fire again until Interspace cycles have passed.
That is precisely what you want for a paddle, a mode button or an upshift request — one press produces one event and holding it does not repeat.
It is precisely wrong for a neutral switch, a brake switch, a clutch switch or any interlock, where the consumer needs the input to stay on while the condition holds. Leave the filter off for those. If such a signal chatters, fix it at the source — the contact, the wiring, or a Compare Input with hysteresis on a measured value.
Full behaviour and the reason Hold does nothing: the event filter.
Common settings
Digital Input also uses the shared Name and Pin settings. See Common IO settings.
Example — neutral switch (a state)
- Type Digital Input, name
Neutral Switch, on the switch's pin. - Mode
Digital In. - The switch closes to sGND in neutral, so it reads on in neutral with Invert off. Turn Invert on if your switch is normally closed.
- Filter off — the driver needs to know that the box is in neutral, not that it entered neutral one cycle ago.
Example — upshift paddle (an event)
- Type Digital Input, name
Upshift Request, on the paddle's pin. - Mode
Digital In, Invert to match the paddle's wiring. - Filter on, Delay
10— the paddle must be held 10 ms, which rejects contact bounce and a knock against the column. - Interspace
150— no second shift request can be generated for 150 ms, so one firm pull is one shift.
Troubleshooting
- The input pulses once and goes back to zero while the switch is still closed: the filter is on. Turn it off for a state signal.
- Reads the opposite of what you expect: toggle Invert. Remember the pin may already be inverted in hardware, so the setting flips the result rather than setting it absolutely.
- A press is sometimes missed: Interspace is still counting down from the previous event, or Delay is longer than the press.
- Setting Hold changes nothing: it is inert. Use Interspace to space events out.
- Duty, Frequency or Time reads zero: the mode does not match the signal, or the waveform is not clean enough to trigger. Check it on the pin, and consider a Frequency Input, which has thresholds you can set.
Related
- Frequency Input — trigger wheels, direction, thresholds
- Analog Switch Input — a switch level on an analog pin
- Counter Input — count the events this input generates
- Common IO settings