Create a FED3 menu

189 views
Skip to first unread message

zane andrews

unread,
Feb 25, 2022, 3:50:37 AM2/25/22
to FEDforum
Hi Lex,

I have made a menu to couple nose pokes with opto stimulation for a bunch of different FED modes (OptoMenu_for_pokes). Everything works fine except the the FR1-5 opto food schedules are stuck on FR1 and I have no idea why....I copied the code from the classicFED3.ino and updated the cpp file. The code works fine in the ClassicFED3 file but not in the menu I created (OptoMenu_for_pokes). I have attached the relevant files so any thoughts or feedback would be appreciated. 

Cheers

ZAne

FED3 OptoMenu no tone.cpp
ClassicFED3.ino
FED3 Zane no tone.cpp
OptoMenu_for_Pokes.ino

Lex Kravitz

unread,
Feb 25, 2022, 3:32:40 PM2/25/22
to FEDforum
Hi Zane!  Cool you're writing custom menus! 

The issue you are experiencing is that your code is never setting the "FR" variable.  the "FR" variable defaults to 1, but can be changed in the code by calling fed3.FR = N, where N is your ratio.  The ClassicMenu script calls a function "ClassicMenu", which you can view in the FED3.cpp file.  Starting in line 1535 the "FR" gets set based on the mode for this Menu:

2022-02-25_14-17-28b.jpg

Because you're not using the "ClassicMenu" function these lines never run.  So you just need to set these explicitly in your Arduino code. ie, for Mode 1 your if statement should be:
   if (fed3.FEDmode == 1) {
      fed3.sessiontype = "FR1 optofood";    //The text in "sessiontype" will appear on the screen and in the logfile
      fed3.FR = 1;
    }

I'm attaching a revision to your code with these updates, let me know if this works!  Best, -Lex
OptoMenu_for_Pokes_LexEdit022522.ino

zane andrews

unread,
Feb 25, 2022, 6:27:37 PM2/25/22
to FEDforum
Thanks Lex - that was did it; all sorted. You're a legend. 

Cheers
Zane
Reply all
Reply to author
Forward
0 new messages