<Z [«id» [«pin» «iFlag»]|«active»]]>
<z [«signedVpin»]|[«vpin» «analogue» [[«profile»] [«duration»]]]>
Manage pin/vpin outputs¶
Serial commands to >Manage pin/vpin outputs.
Commands¶
<Z>List Output definitions<Z «id» «active»>Set output<Z «id» «pin» «iFlag»>Create Output<Z «id»>Delete output<z «signedVpin»>Set pin. HIGH if vpin positive, LOW if vpin negative<z «vpin» «analogue» «profile» duration»>Change analogue value over duration (Fade or servo move)<z «vpin» «analogue» «profile»>Write analogue device using profile number (Fade or servo movement)<z «vpin» «analogue»>Write analogue device value
Parameters¶
- id: identifier of the output
- vpin: The pin number of the output to be controlled by the output object.
For Arduino output pins, this is the same as the digital pin number. For servo outputs and I/O expanders, it is the pin number defined for the HAL device (if present), for example 100-115 for servos attached to the first PCA9685 Servo Controller module, 116-131 for the second PCA9685 module, 164-179 for pins on the first MCP23017 GPIO expander module, and 180-195 for the second MCP23017 module.- positive vpin = ACTIVE/HIGH
- negative vpin = INACTIVE/LOW
- iFlag: see below:
- iFlag, *bit 0():
0= forward operation (ACTIVE=HIGH / INACTIVE=LOW)1= inverted operation (ACTIVE=LOW / INACTIVE=HIGH)
- iFlag, bit 1:
0= state of pin restored on power-up to either ACTIVE or INACTIVE depending on state before power-down.1= state of pin set on power-up, or when first created, to either ACTIVE of INACTIVE depending on IFLAG, bit 2
- iFlag, bit 2:
0= state of pin set to INACTIVE upon power-up or when first created1= state of pin set to ACTIVE upon power-up or when first created
- iFlag, *bit 0():
Responses¶
Response for <Z «id»>, <Z «id» «pin» «iFlag»>¶
(Successful): <O>
(Fail): <X> (e.g. out of memory).
Response for <Z>¶
(Successful):
(Fail):
- Y: Command identifier
- id: identifier of the output
- state: one of
0= INACTIVE1= ACTIVE
Response for <Z «vpin»>¶
N/A
Response for <Z «id» «state»>¶
(Successful):
(Fail):
- Y: Command identifier
- state: one of
0= INACTIVE1= ACTIVE
Response for <z «vpin» «analogue» «profile» duration»>``, ``<z «vpin» «analogue» «profile»>``, ``<z «vpin» «analogue»>¶
TODO Response
Notes¶
- EX‑CommandStation supports optional OUTPUT control of any unused Arduino Pins for custom purposes. Pins can be activated or de-activated. The default is to set ACTIVE pins HIGH and INACTIVE pins LOW. However, this default behaviour can be inverted for any pin in which case ACTIVE=LOW and INACTIVE=HIGH.
- Definitions and state (ACTIVE/INACTIVE) for pins are retained in EEPROM and restored on power-up. The default is to set each defined pin to active or inactive according to its restored state. However, the default behaviour can be modified so that any pin can be forced to be either active or inactive upon power-up regardless of its previous state before power-down.
- To have EX‑CommandStation utilise one or more Arduino pins as custom outputs, first define/edit/delete output definitions using the following variation of the
<Z>command, or the lowercase<z>command can be used with no pre-definition required. <Z «id» «state»>- When controlled as such, the Arduino updates and stores the direction of each output in EEPROM so that it is retained even without power. A list of the current states of each output in the form
<Y «id» «state»>is generated by EX‑CommandStation whenever the<s>status command is invoked. This provides an efficient way of initializing the state of any outputs being monitored or controlled by a separate interface or GUI program.
- When controlled as such, the Arduino updates and stores the direction of each output in EEPROM so that it is retained even without power. A list of the current states of each output in the form
Examples¶
Example Commands¶
- TODO LOW - Example Commands
Example Responses:¶
- TODO LOW - Example Responses