Hi Matt,
Reponses in-line below:
[i]What is the syntax for using the threshold as a state-change for the state machine? Is it something like 'AnalogInput1_1', 'AnalogInput1_2', etc. for the thresholds on each channel, respectively?
Threshold crossing events are named AnalogIn1_N, where N is the channel. In general, the 'magnifying glass' icon on the Bpod console will show you a table of valid events, given the state machine model and its detected modules.
[i]Can I set a 'goal state' and then have a timer run within that state, so that the trial will terminate when that timer is up?
Yes, I don't see why not. Is the question about how to implement this while the state is waiting for something else to happen?
[i]Can I connect my analog signal to multiple analog input channels so I can essentially set multiple thresholds for the same signal? Like say I want to trigger a threshold crossing of both 5V and 6V. Can this be accomplished by simply connecting the same analog signal to two input channels and setting a 5V threshold on the first channel and a 6V on the other?
I did a basic test and it looks like this works. The input channels are high impedance. Please note that the channels do not have channel-to-channel isolation, and share a ground plane - so for this application you can make a single connection from the signal's ground to one of the 8 ground terminals, and jump the signal between the remaining input channels.
[i]When I call the function 'getData()', does it only return data between the most recent 'startLogging()' and 'stopLogging()' commands?
Yes. To make the timing of the samples match the timing of each trial's events, you can have your first state start the logging by using the following output action: {'AnalogIn1', ['L' 1]};
To stop the logging from the state machine (e.g. at the end of the trial) you can use:
{'AnalogIn1', ['L' 0]} - or you can stop it from the PC with the BpodAnalogIn class.
In general, byte commands from the state machine to its modules are documented in the 'Module Serial Interfaces' pages here.
I hope this helps!
-Josh