Sending a TTL pulse when pellet is dispensed?

35 views
Skip to first unread message

JP Riggle

unread,
Mar 18, 2026, 8:08:00 PM (14 days ago) Mar 18
to FEDforum
Hello I'd like to send a ttl pulse when the pellet is dispensed separate from the one when its retrieved. I'm using Fed.feed(100) to account for the pellet taken and I tried to modify the FED3 C++ code to account for the dispensed using a prior example from the forum by inserting  BNC (150,1);  but I am seemingly not getting that ttl pulse. 

//If pellet is detected during or after this motion
    if (pelletDispensed == true) {    
      ReleaseMotor ();
      pelletTime = millis();
      BNC (150,1);
      display.fillCircle(25, 99, 5, BLACK);
      display.refresh();
      retInterval = (millis() - pelletTime);
      //while pellet is present and under 60s has elapsed
      while (digitalRead (PELLET_WELL) == LOW and retInterval < 60000) {  //After pellet is detected, hang here for up to 1 minute to detect when it is removed
        retInterval = (millis() - pelletTime);
        DisplayRetrievalInt();


any guidance would be appreciated!
FED3.cpp

JP Riggle

unread,
Mar 18, 2026, 8:46:40 PM (14 days ago) Mar 18
to FEDforum
As it turns out I am actually getting that pulse I guess the mouse was just pausing a long time for the first couple pellets and I somehow managed to miss it. 
Reply all
Reply to author
Forward
0 new messages