Hello Paola,
Bpod's RS-485 module connection is polar. This means that the wiring is different on the state machine side (S) and the module side (M).
The second port provided on some modules was set up with the following convention:
Modules that capture streaming data (Analog Input, Rotary Encoder): M-type
Modules with streaming output (Analog Output, DDS): S-type
The valve driver module is M-type, and unfortunately so is the Rotary Encoder's 'Module' port, so they cannot communicate directly.
Depending on your application you may be able to accomplish what you're trying to do by having the state machine act as a relay. It can set the valve driver module when the rotary encoder module returns an event. You can mitigate interruption of the flow of states using the >back
command (example here), and use global timers instead of state timers (which reset each time you re-enter the state).
Please let me know whether this works for you.
Thanks,
Josh