SyncFED3 - KravitzLab/KreedLabWiki GitHub Wiki
FED3 synchronization with fed3.BNC() and fed3.pulseGenerator() functions
Use fed3.BNC(DELAY_MS, loops) to send sync signals from FED3 to a photometry or ephys recording system (or even another FED!) through the BNC output.
How it works
fed3.BNC(DELAY_MS, loops);
Examples:
fed3.BNC(20, 1)= one 20ms pulsefed3.BNC(20, 3)= three 20ms pulsesfed3.BNC(500, 1)= one 500ms pulse
Two common ways to use it
1. Short pulse trains
Useful for marking different behavioral events. Examples:
fed3.BNC(50, 1);// 1 pulse means Pelletfed3.BNC(50, 2);// 2 pulses means Left pokefed3.BNC(50, 3);// 3 pulses mean Right poke
2. Long pulses
Also useful for marking different behavioral events.
fed3.BNC(50, 1);// 50ms means Pelletfed3.BNC(100, 1);// 100ms means Left pokefed3.BNC(200, 1);// 200ms means Right poke
pulseGenerator()
How it works
fed3.pulseGenerator(pulse_width, frequency, repetitions) to send a pulse train with more precise control over pulse timing than fed3.BNC().
Arguments
pulse_width: pulse duration in millisecondsfrequency: pulse frequency in Hzrepetitions: number of pulses in the train
Example:
fed3.pulseGenerator(10, 20, 20);
This sends:
- 10 ms pulses
- at 20 Hz
- for 20 repetitions
Notes:
fed3.BNC()andfed3.pulseGenerator()are blocking because they uses delays internally. This means that no other code will run during the pulses. If you make a 2s pulse, the FED will be unresponsive for 2s while it is making the pulse. Use pulses short enough that they do not interfere with the behavioral task.- It is a good idea to test everything in your recording setup before assuming it works - improper grounding, inputs, etc, may mean your pulses won't show up as you expect them to.
- It is a good idea to verify you can decode your pulse scheme before doing a billion recordings and learning there's an issue :)