Hi Cyuan
Funny you should mention the rotary encoder - we designed a Bpod module to encapsulate exactly that part:
[attachment=8]
We'll release it very soon - probably within the next week or 2. The firmware records the encoder position, beginning with a "start" byte sent from the Bpod state machine. When configurable thresholds are crossed, the module sends events back to the state machine. In parallel, it can also stream the encoder position to the DDS or Analog Output modules, for closed loop sensory applications in parallel with the state machine.
In response to your more general question about I/O, if you're using the beta branch, you should be able to add Arduino channels by changing 2 lines in the firmware.
Near the top of the firmware file, you'll see 2 lines with hardware description bytes:
byte InputHW[] = {'U','U','U','X','B','B','W','W','P','P','P','P','P','P','P','P'};
byte InputCh[] = {0,0,0,0,10,11,31,29,28,30,32,34,36,38,40,42};
The top row specifies the type of input channel, and the bottom row specifies the corresponding Arduino pin.
'W' is wire - so if you wanted to add Arduino pin 13, you could add 'W' to the "W" part of top vector (i.e. at position 8, shifting everything else rightwards), and 13 at the equivalent position in the bottom vector. Pin 13 would then be known to Bpod as Wire input channel 3.
One thing to note - the state machine firmware is pretty busy already, and reading a rotary encoder can hog the CPU - especially when it has 1024 positions and it is turning quickly. For this application, I'd strongly consider a solution like the rotary encoder module, or a dedicated Arduino M0 + Bpod shield. If you go the latter route, the BlinkModule sketch is a good starting point. In either case, you'll need Bpod 0.7 or 0.8, which support the standardized Bpod module interface (RS485-buffered UART over an Ethernet twisted pair at 1.3Mb/s). Bpod 0.5 has two serial channels, both unbuffered, and they can only be used as outputs.
Good luck building, and please let us know what you decide to implement in the end!
-Josh