Inquiry on Defining TTL Pulses with the Blink Function in FED3

38 views
Skip to first unread message

Arpit Kumar Pradhan

unread,
Feb 28, 2025, 3:14:16 PMFeb 28
to FEDforum

Dear FED3 Community,

I am currently working on a fiber photometry project and have been integrating the FED3 system for controlling stimulus events and recording data. While setting up my code, I came across a forum post where a user mentioned using a Blink function to send TTL pulses to the TDT system. I am trying to use the function similarly in my code to trigger TTL pulses for different events, such as nose pokes and pellet retrieval, while recording the photometry signals.

Specifically, I am trying to use the Blink function as follows:

Blink(BNC_OUT, 200, 1); // Send TTL pulse for pellet retrieval (1 pulse, 200 ms)

However, I am not sure if this Blink function is already defined by the FED3 library. If so, I would appreciate it if someone could guide me to where I can find the definition or documentation for it. If the function is not part of the library, I would like to ask for advice on how best to define it in my code.

For reference, here is the section of my code where I am attempting to use the Blink function:
#include <FED3.h>  // Include the FED3 library

String sketch = "soundWindow";  // Unique identifier text for each sketch
FED3 fed3(sketch);  // Start the FED3 object

// Other parts of the code...

void setup() {
  fed3.begin();  // Setup the FED3 hardware
  fed3.disableSleep();
  Serial.begin(9600);  // Initialize serial communication
  fed3.DisplayPokes = true;  // Enable poke indicators on the display
  pinMode(BNC_OUT, OUTPUT);  // Set up the TTL output pin
}

void loop() {
  fed3.run();  // Run FED3 main logic
  unsigned long currentTime = millis();

  // Check for pellet retrieval
  if (fed3.Feeding) {  // If a pellet is dispensed
    Blink(BNC_OUT, 200, 1);  // Send TTL for pellet retrieval (1 pulse, 200 ms)
    Serial.println("Pellet retrieved!");  // Print message
  }
 
  // Other logic...
}

Lex

unread,
Mar 1, 2025, 1:49:31 PMMar 1
to Arpit Kumar Pradhan, FEDforum
Hi Arpit,
There is no function called "Blink" in the FED3 library but there is a function called "BNC" that will do what you want.  Documentation is here.

Usage:
fed3.BNC(delay, number);  //Send number of pulses of length delay from the FED3 output port. 

Example:
fed3.BNC(20, 5); //send five 20ms pulses from the BNC port

Hopefully this does what you want!  
Best, -Lex



--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fedforum/28e4a2e0-4d23-4080-8a59-6122350923dan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages