2. In my new protocol, I will give a 3s light cue, and I also want to send a 3s Opto-stim simultaneously, how to do that?
If I'm interpreting correctly, you'd like to light up the Neopixels for 3s while also pulsing a 3s optogenetic stimulation.
I would start by editing the FED3 example "Optogenetic_Self_Stim". The command fed3.pulseGenerator(10, 20, 20) in line 28 of this example will deliver a train of 10ms pulses at 20Hz for 1 sec. So we can change this to: fed3.pulseGenerator(10, 20, 60) to extend this train to 3s (60 pulses). You can also change the pulse width or frequency here.
To make the Neopixels also light up in white while this is happening we can call
fed3.pixelsOn(5, 5, 5, 5); right before we call the pulseGenerator, and then call
fed3.pixelsOff() when we're done. I'm attaching a modified example code that contains these edits, let me know if this does what you want!
Best, -Lex