You must assign a pin number and attributes to each pin used in your configuration. FluidNC will know whether the pins is an input, output, etc. based the the feature it is assigned to. For example, it knows that GPIO assigned to a limit switch will always be an input. There are a few attributes for each type of pin. Each attribute has a default state, so they are all optional. Each attribute is preceded with a colon. They can be used in any order.
There are currently two types of pins that can be used, gpio and i2so. You specify a pin with the type, followed by a period, followed by the pin number. For example, gpio.14 or i2so.24
- gpio These are native ESP32 pins. They are quite flexible and can be used for most features.
- i2so These are on external I2S chips. They are output only and cannot be used for advanced things like PWM. They are only available on controller hardware that implements them, like the 6 Pack. Note: At initial power on, these will often turn on briefly. Keep this in mind if you are using them to turn on devices. Consider powering those on after booting.
If you use i2so output pins you must have an i2so section in your config file. These are the control pins for the i2so chips.
Warning: The I2SO pins come on in an indeterminate state at power on. The firmware will quickly set them to the desired state. This means the pin may be in the wrong state for a fraction of a second at power on. They will maintain the current state if the firmware is reset. If you have them controlling a spindle, laser or other dangerous items, you should apply power to them after the firmware is running.
- Active state Each input feature has an active state. For example, the active state of a switch would be when the switch is pushed. Depending on your switch type and wiring the switch may be connecting to a low voltage (ground) or a logic high voltage to the CPU when the switch is pushed. You specify this in your configuration with the high or low attribute. Examples: gpio:14:high or gpio.14:low It will use the default of high if it is not specified. If your switch is reporting backwards from what you want, flip the :high to :low or the other way around.
- Pulling resistor You can add an internal pull-up or pull-down resistor to input pins that support them. This is done with the pu (pull-up) or pd (pull-down) attribute. Examples: gpio.14:high:pd or gpio.14:low:pu. The default is no pulling resistor. The pin will be floating unless you have an external circuit that pulls it one way or the other. This typically causes incorrect pin readings when the circuit is in the open state. Note: Some pins do not support internal pulling resistors and you must provide and external one.
- Active state Each output feature has an active state. This usually means the feature is on. Depending on your circuitry, a low or high output signal will turn on the feature. You specify this in your configuration with the high or low attribute. Examples: gpio:14:high or gpio.14:low It will is the default of high if it is not specified.
If your feature is working backwards (inverted, wrong way, flipped) from what you want, like the direction pin for a motor, flip the hi to low, or the other way around.