Hello Josh,
I check RP2. I had a mistake that I defined 1 V TTL output in RP2. I change it to 5V and now Bpod change event to BNC1High and BNC1Low when I send TTL from RP2. I have two issue. First the script works for only one TTL and I need to open and close the valve until send TTL from RP2. Second, when I run script, by getting TTL, valve open or close until next TTL (after 2 TTL valve is open or close again). Before I run Bpod tha console status is:
Current State: Closevalve
Previous state: openvalve
Last Events: BNC1High
my last script:
function Airpuf2
global BpodSystem
sma = NewStateMachine();
sma = AddState(sma, 'Name', 'Openvalve', ...
'Timer', 0.1,...
'StateChangeConditions', {'BNC1High', 'Closevalve'},...
'OutputActions', {});
sma = AddState(sma, 'Name', 'Closevalve', ...
'Timer', 0.2,...
'StateChangeConditions', {'BNC1High', '>exit'},...
'OutputActions', {'Valve1', 1});
SendStateMatrix(sma);
RawEvents = RunStateMatrix;
end