Convert a (GPIO) number to a PORT value
IN(number, default=0) — a number defining a GPIO
PORT(port) — GPIO that matches the input number
- ‘ERR’ (pulse) — input value cannot be mapped to a valid PORT
Extra info: different boards have different mappings between GPIO numbers and marked ports such as D0 - Dn.
For example on a NodeMCU board, in order to use pin D1 one has to select D5 in the UI instead of D1
It is therefore easier to use GPIO numbers, and specify we want GPIO 5. This new node would allow us to define 5 in the inspector (or as an output from another node) and have that passed through to a PORT input.
If instead, port numbers could be automatically mapped based on the board in use, then this would remove the need for this node. In other words, if I pick a NodeMCU board and I use D1, then use GPIO value = 5 under the covers.