Hi Kun,
I'm assuming you've used all of the input and LED channels on the port interface boards (normally for nosepokes and LEDs, but unused channels can work as digital GPIO)
You can set the analog input module to detect incoming 3.3 or 5V pulses using its MATLAB class: https://sanworks.github.io/Bpod_Wiki/module-documentation/analog-input-module/
The code to set up a channel (for instance, channel 2) is roughly:
myChannel = 2;
A = BpodAnalogIn('COM3');
A.Thresholds(myChannel) = 2.5;
A.ResetVoltages(myChannel) = 1;
A.SMeventsEnabled(myChannel) = 1;
A.startReportingEvents();
This will return AnalogIn1_2 events each time the line goes from low to high. Unlike the BNC and port input channels, you won't get events when the line goes from high -> low. Also keep in mind that the input channel is not optically isolated, so make sure the input voltage is something reasonable (-10 to +10VDC).
For output, you'd use the WavePlayer class to play 5V pulses on trigger.
I hope this helps!
-Josh