Skip to content

2. Variables

Kravitz Lab edited this page Mar 12, 2022 · 23 revisions

These variables can be set or recalled in your Arduino sketch to control FED3

  • String sketch: String, unique identifier text for each sketch (this will show up on the screen and in log file). Example:
String sketch = "FreeFeed";  

Poke and pellet variables

  • LeftCount: Int, total number of pokes on the left nosepoke, initializes to 0
  • leftInterval: Int, duration of the last left nosepoke in ms
  • RightCount: Int, number of pokes on the right nosepoke, initializes to 0
  • rightInterval: Int, duration of the last right nosepoke in ms
  • PelletCount: Int, total number of pellets dispensed, initializes to 0
  • retInterval: Int, how long the pellet remained in the well before it was taken in ms. Times out at 60000ms
  • minPokeTime: Int, minimum duration for a poke to count, in ms. Initializes to 0. Example:
fed3.minPokeTime = 1000;                               //Set minPokeTime to 1000ms
if (fed3.leftInterval > fed3.minPokeTime) {            //Check if the left poke held longer than minPokeTime
      fed3.Feed();                                     //Feed 
}

Timing variables

  • currentHour: Unsigned long, returns the current hour from the RTC
  • currentMinute: Unsigned long, returns the current minute from the RTC

Task control

  • timeout: Int, a timeout period where FED3 will be unresponsive (in seconds). Initializes to 0. Example:
    fed3.timeout = 10; //Set a timeout period of 10 seconds, starting after each pellet is taken
  • Event: String, variable containing which type of event triggered the datalogging, options are Left, Right, or Pellet

Startup Menu

  • FED3Menu: Boolean, defaults to "false". Set to "true" to run a simple menu system at startup to choose between programs
fed3.FED3Menu = true;                                  //Run menu at Startup

BNC port variables

  • BNCinput: Boolean, defaults to "false". Will become "true" when the BNC_OUT port is set as an input and a HIGH pulse is detected. Example useage
  if (fed3.BNCinput == true) {                          //If HIGH is detected on BNC input
    fed3.Feed();                                        //Deliver pellet
  }

Suppress SD card errors

  • suppressSDerrors: Boolean, defaults to "false". If set to true, you can boot FED3 without an SD card, which can be useful for debugging. Place this call before fed3.begin();
fed3.suppressSDerrors = true;