Two methods are provided to interact with digital and analog I/O pins--at the individual pin level, and in pin-groups at the "port" level. The port mode is used for high-speed reporting of inputs. The pin/port message names are dependent on the hardware platform and correspond to the silk-screened names. The examples here use /ra and /rb consistent with the Sparkfun Bitwacker--for the CUI the equivalent would be /a, /b, /c, /d and /an.
The value of an analog input pin is reported as a floating-point number normalized to the range [0.0 - 1.0], inclusive.
The value of a digital input or output pin is reported using the binary T and F types, which in OSC are encoded with a typetag but have no corresponding data section.
A pin which is not connected or in a reserved state (e.g. in use by a hardware module) is reported as type "N" or NULL.
-----
**/ra** : Report/set pin values, port-oriented.
This message is automatically and continuously transmitted at the device reporting rate (500hz), for all ports on the device.
Example 1:
RX: [ /ra ,ffffTf (value of /ra/0) (value of /ra/1) (value of /ra/2) (value of /ra/3) (value of /ra/5) ]
Example 2: Setting of /ra/4 with a port message (assuming its current state is digital output).
TX: [ /ra ,NNNNF ]
RX: [ /ra ,ffffFf (value of /ra/0) (value of /ra/1) (value of /ra/2) (value of /ra/3) (value of /ra/5) ]
-----
**/ra/0/dir** : Get/set pin direction
Pin direction state can take on three values; "input", "output" and "nc" (not-connected).
Enables user to set an individual pin value without using a port-control message. Understands "low", "high", 0, 1, 0.0 and 1.0. If the pin is not already in output direction, it is changed automatically. If the input value is -1, or -1.0, then its mode is changed to input.